File: /data/wwwroot/wordpress/wp-content/themes/yantou/single-news.php
<?php
/*
Template Name: 新闻详情
Author: 畔游科技
Version: 1.0
*/
get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="luxy">
<main id="main">
<div class="g_body n_news_d n_pro">
<div class="n_banner banner">
<div class="img">
<div class="g_bg" style="background-image: url('<?php echo of_get_option('banner_news'); ?>')">
</div>
</div>
</div>
<div class="n_top" style=" background: #f4f4f4; ">
<div class="g_w">
<div class="n_breadcrumb">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>">首页</a>><a href="/news">新闻中心</a>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</div>
</div>
</div>
<div class="n_con">
<div class="con1" id="link1">
<div class="g_w">
<div class="view">
<div class="title">
<h1><?php the_title(); ?></h3>
<span>
<em>发布时间:<?php the_time('Y-m-d'); ?></em><em>浏览次数:<?php get_post_views($post -> ID); ?></em><em>作者:岩投</em>
</span>
</div>
<div class="text">
<?php the_content(); ?>
</div>
<div class="detail-nextpage">
<ul>
<?php
$categories = get_the_category();
$categoryIDS = array();
foreach ($categories as $category) {
array_push($categoryIDS, $category->term_id);
}
$categoryIDS = implode(",", $categoryIDS);
?>
<li class="py_next">
<?php if (get_next_post($categoryIDS)) { next_post_link('<h3>上一篇: %link','%title',true);} else { echo "已是最新文章";} ?>
</li>
<li class="py_previou">
<?php if (get_previous_post($categoryIDS)) { previous_post_link('<h3>下一篇: %link','%title',true);} else { echo "已是最后文章";} ?>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<?php endwhile; endif; ?>
<script>
document.getElementById("head_li_3").className = "active";
</script>
<?php get_footer(); ?>