feat: add article layout (#219)

pull/230/head
Seaton Jiang 2020-06-08 10:49:02 +08:00
parent a09a3b7c12
commit 9a3d0191cd
4 changed files with 23 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

View File

@ -24,6 +24,8 @@ function kratos_options()
{
$sitename = get_bloginfo('name');
$imagepath = get_template_directory_uri() . '/assets/img/options/';
$seorobots = '<a href="' . home_url() . '/robots.txt" target="_blank">robots.txt</a>';
$seoreading = '<a href="' . admin_url('options-reading.php') . '" target="_blank">' . __('设置-阅读-对搜索引擎的可见性', 'kratos') . '</a>';
@ -344,6 +346,17 @@ function kratos_options()
'type' => 'upload',
);
$options[] = array(
'name' => __('页面布局', 'kratos'),
'desc' => __('是否显示侧边栏小工具(默认显示侧边栏),仅在文章页面生效', 'kratos'),
'id' => "g_article_wodgets",
'std' => "two_side",
'type' => "images",
'options' => array(
'one_side' => $imagepath . 'col-12.png',
'two_side' => $imagepath . 'col-8.png')
);
$options[] = array(
'name' => __('站长配置', 'kratos'),
'type' => 'heading',

View File

@ -6,11 +6,17 @@
* @version 2020.03.16
*/
get_header(); ?>
get_header();
$col_array = array(
'one_side' => 'col-lg-12',
'two_side' => 'col-lg-8'
);
$select_col = $col_array[kratos_option('g_article_wodgets', 'two_side')];
?>
<div class="k-main <?php echo kratos_option('top_select', 'banner'); ?>" style="background:<?php echo kratos_option('g_background', '#f5f5f5'); ?>">
<div class="container">
<div class="row">
<div class="col-lg-8 details">
<div class="<?php echo $select_col ?> details">
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
<div class="article">
<div class="breadcrumb-box">
@ -128,9 +134,11 @@ get_header(); ?>
</nav>
<?php comments_template(); ?>
</div>
<?php if (kratos_option('g_article_wodgets', 'two_side') == 'two_side'){ ?>
<div class="col-lg-4 sidebar d-none d-lg-block">
<?php dynamic_sidebar('sidebar_tool'); ?>
</div>
<?php } ?>
</div>
</div>
</div>