mirror of https://github.com/vtrois/kratos
refactor: change option id
parent
bf15cd960d
commit
340a746826
89
single.php
89
single.php
|
@ -1,9 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章内容
|
* 文章内容
|
||||||
* @author Seaton Jiang <seatonjiang@vtrois.com>
|
* @author Seaton Jiang <seatonjiang@vtrois.com>
|
||||||
* @license MIT License
|
* @license MIT License
|
||||||
* @version 2021.07.01
|
* @version 2021.08.19
|
||||||
*/
|
*/
|
||||||
|
|
||||||
get_header();
|
get_header();
|
||||||
|
@ -17,12 +18,13 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="<?php echo $select_col ?> details">
|
<div class="<?php echo $select_col ?> details">
|
||||||
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
|
<?php if (have_posts()) : the_post();
|
||||||
|
update_post_caches($posts); ?>
|
||||||
<div class="article">
|
<div class="article">
|
||||||
<div class="breadcrumb-box">
|
<div class="breadcrumb-box">
|
||||||
<ol class="breadcrumb">
|
<ol class="breadcrumb">
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a class="text-dark" href="<?php echo home_url(); ?>"> <?php _e('首页' , 'kratos'); ?></a>
|
<a class="text-dark" href="<?php echo home_url(); ?>"> <?php _e('首页', 'kratos'); ?></a>
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
$cat_id = get_the_category()[0]->term_id;
|
$cat_id = get_the_category()[0]->term_id;
|
||||||
|
@ -34,7 +36,7 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
$categoryURL = get_category_link($cat);
|
$categoryURL = get_category_link($cat);
|
||||||
$name = $cat_object->name;
|
$name = $cat_object->name;
|
||||||
$cat_id = $cat_object->parent;
|
$cat_id = $cat_object->parent;
|
||||||
$add_link = '<li class="breadcrumb-item"> <a class="text-dark" href="'.$categoryURL.'">'.$name.'</a></li>';
|
$add_link = '<li class="breadcrumb-item"> <a class="text-dark" href="' . $categoryURL . '">' . $name . '</a></li>';
|
||||||
$breadcrumb = substr_replace($breadcrumb, $add_link, 0, 0);
|
$breadcrumb = substr_replace($breadcrumb, $add_link, 0, 0);
|
||||||
if ($cat_id == 0) {
|
if ($cat_id == 0) {
|
||||||
$if_parent = FALSE;
|
$if_parent = FALSE;
|
||||||
|
@ -42,27 +44,38 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
}
|
}
|
||||||
echo $breadcrumb;
|
echo $breadcrumb;
|
||||||
?>
|
?>
|
||||||
<li class="breadcrumb-item active" aria-current="page"> <?php _e('正文' , 'kratos'); ?></li>
|
<li class="breadcrumb-item active" aria-current="page"> <?php _e('正文', 'kratos'); ?></li>
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1 class="title"><?php the_title(); ?></h1>
|
<h1 class="title"><?php the_title(); ?></h1>
|
||||||
<div class="meta">
|
<div class="meta">
|
||||||
<span><?php echo get_the_date(); ?></span>
|
<span><?php echo get_the_date(); ?></span>
|
||||||
<span ><?php echo get_post_views(); _e('点热度' , 'kratos'); ?></span>
|
<span><?php echo get_post_views();
|
||||||
<span><?php if (get_post_meta($post->ID, 'love', true)) { echo get_post_meta($post->ID, 'love', true); } else {echo '0'; } _e('人点赞', 'kratos'); ?></span>
|
_e('点热度', 'kratos'); ?></span>
|
||||||
<span><?php comments_number('0', '1', '%'); _e('条评论', 'kratos'); ?></span>
|
<span><?php if (get_post_meta($post->ID, 'love', true)) {
|
||||||
<?php if (current_user_can('edit_posts')){ echo '<span>'; edit_post_link(__('编辑文章', 'kratos')); echo '</span>'; }; ?>
|
echo get_post_meta($post->ID, 'love', true);
|
||||||
|
} else {
|
||||||
|
echo '0';
|
||||||
|
}
|
||||||
|
_e('人点赞', 'kratos'); ?></span>
|
||||||
|
<span><?php comments_number('0', '1', '%');
|
||||||
|
_e('条评论', 'kratos'); ?></span>
|
||||||
|
<?php if (current_user_can('edit_posts')) {
|
||||||
|
echo '<span>';
|
||||||
|
edit_post_link(__('编辑文章', 'kratos'));
|
||||||
|
echo '</span>';
|
||||||
|
}; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content" id="lightgallery">
|
<div class="content" id="lightgallery">
|
||||||
<?php
|
<?php
|
||||||
if(kratos_option('s_singletop',false)){
|
if (kratos_option('s_singletop', false)) {
|
||||||
if(kratos_option('s_singletop_links')){
|
if (kratos_option('s_singletop_url')) {
|
||||||
echo '<a href="'. kratos_option('s_singletop_links') .'" target="_blank" rel="noreferrer">';
|
echo '<a href="' . kratos_option('s_singletop_url') . '" target="_blank" rel="noreferrer">';
|
||||||
}
|
}
|
||||||
echo '<img src="'.kratos_option('s_singletop_url').'">';
|
echo '<img src="' . kratos_option('s_singletop_img') . '">';
|
||||||
if(kratos_option('s_singletop_links')){
|
if (kratos_option('s_singletop_url')) {
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,8 +94,8 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
'before' => '',
|
'before' => '',
|
||||||
'after' => '',
|
'after' => '',
|
||||||
'next_or_number' => 'number',
|
'next_or_number' => 'number',
|
||||||
'link_before' =>'<span>',
|
'link_before' => '<span>',
|
||||||
'link_after'=>'</span>'
|
'link_after' => '</span>'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
wp_link_pages(
|
wp_link_pages(
|
||||||
|
@ -94,18 +107,18 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
'nextpagelink' => __('<span>下一页</span>', 'kratos')
|
'nextpagelink' => __('<span>下一页</span>', 'kratos')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if(kratos_option('s_singledown',false)){
|
if (kratos_option('s_singledown', false)) {
|
||||||
if(kratos_option('s_singledown_links')){
|
if (kratos_option('s_singledown_url')) {
|
||||||
echo '<a href="'. kratos_option('s_singledown_links') .'" target="_blank" rel="noreferrer">';
|
echo '<a href="' . kratos_option('s_singledown_url') . '" target="_blank" rel="noreferrer">';
|
||||||
}
|
}
|
||||||
echo '<img src="'.kratos_option('s_singledown_url').'">';
|
echo '<img src="' . kratos_option('s_singledown_img') . '">';
|
||||||
if(kratos_option('s_singledown_links')){
|
if (kratos_option('s_singledown_url')) {
|
||||||
echo '</a>';
|
echo '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php if(kratos_option('g_cc_switch', false)){
|
<?php if (kratos_option('g_cc_switch', false)) {
|
||||||
$cc_array = array(
|
$cc_array = array(
|
||||||
'one' => __('知识共享署名 4.0 国际许可协议', 'kratos'),
|
'one' => __('知识共享署名 4.0 国际许可协议', 'kratos'),
|
||||||
'two' => __('知识共享署名-非商业性使用 4.0 国际许可协议', 'kratos'),
|
'two' => __('知识共享署名-非商业性使用 4.0 国际许可协议', 'kratos'),
|
||||||
|
@ -116,16 +129,20 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
);
|
);
|
||||||
$select_cc = $cc_array[kratos_option('g_cc', 'one')];
|
$select_cc = $cc_array[kratos_option('g_cc', 'one')];
|
||||||
echo '<div class="copyright"><span class="text-center">';
|
echo '<div class="copyright"><span class="text-center">';
|
||||||
printf( __( '本作品采用 %s 进行许可','kratos' ) , $select_cc );
|
printf(__('本作品采用 %s 进行许可', 'kratos'), $select_cc);
|
||||||
echo '</span></div>';
|
echo '</span></div>';
|
||||||
} ?>
|
} ?>
|
||||||
<div class="footer clearfix">
|
<div class="footer clearfix">
|
||||||
<div class="tags float-left">
|
<div class="tags float-left">
|
||||||
<span><?php _e('标签:' , 'kratos'); ?></span>
|
<span><?php _e('标签:', 'kratos'); ?></span>
|
||||||
<?php if ( get_the_tags() ) { the_tags('', ' ', ''); } else{ echo '<a>' . __( '暂无' , 'kratos') . '</a>'; }?>
|
<?php if (get_the_tags()) {
|
||||||
|
the_tags('', ' ', '');
|
||||||
|
} else {
|
||||||
|
echo '<a>' . __('暂无', 'kratos') . '</a>';
|
||||||
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="tool float-right d-none d-lg-block">
|
<div class="tool float-right d-none d-lg-block">
|
||||||
<span><?php _e('最后更新:','kratos'); ?><?php the_modified_date(); ?></span>
|
<span><?php _e('最后更新:', 'kratos'); ?><?php the_modified_date(); ?></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -134,20 +151,20 @@ $select_col = $col_array[kratos_option('g_article_widgets', 'two_side')];
|
||||||
<nav class="navigation post-navigation clearfix" role="navigation">
|
<nav class="navigation post-navigation clearfix" role="navigation">
|
||||||
<?php
|
<?php
|
||||||
$prev_post = get_previous_post(TRUE);
|
$prev_post = get_previous_post(TRUE);
|
||||||
if(!empty($prev_post)){
|
if (!empty($prev_post)) {
|
||||||
echo '<div class="nav-previous clearfix"><a title="'.$prev_post->post_title .'" href="'.get_permalink($prev_post->ID).'">'. __('< 上一篇','kratos') .'</a></div>';
|
echo '<div class="nav-previous clearfix"><a title="' . $prev_post->post_title . '" href="' . get_permalink($prev_post->ID) . '">' . __('< 上一篇', 'kratos') . '</a></div>';
|
||||||
}
|
}
|
||||||
$next_post = get_next_post(TRUE);
|
$next_post = get_next_post(TRUE);
|
||||||
if(!empty($next_post)){
|
if (!empty($next_post)) {
|
||||||
echo '<div class="nav-next"><a title="'. $next_post->post_title .'" href="'. get_permalink($next_post->ID) .'">'. __('下一篇 >','kratos') .'</a></div>';
|
echo '<div class="nav-next"><a title="' . $next_post->post_title . '" href="' . get_permalink($next_post->ID) . '">' . __('下一篇 >', 'kratos') . '</a></div>';
|
||||||
}?>
|
} ?>
|
||||||
</nav>
|
</nav>
|
||||||
<?php comments_template(); ?>
|
<?php comments_template(); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if (kratos_option('g_article_widgets', 'two_side') == 'two_side'){ ?>
|
<?php if (kratos_option('g_article_widgets', 'two_side') == 'two_side') { ?>
|
||||||
<div class="col-lg-4 sidebar sticky-sidebar d-none d-lg-block">
|
<div class="col-lg-4 sidebar sticky-sidebar d-none d-lg-block">
|
||||||
<?php dynamic_sidebar('single_sidebar'); ?>
|
<?php dynamic_sidebar('single_sidebar'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue