File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/heku-cms/TempParts/Single/single-news.php
<?php
use Heku\Modules\Common\Post;
/**
* 新闻详情页
*/
?>
<!-- / star heku_top -->
<?php get_template_part( "TempParts/Main/TopMenu/top_menu"); ?>
<?php get_template_part( "TempParts/Main/TopBanner/top_banner"); ?>
<!-- / end heku_top -->
<!-- / star single_bar_line -->
<?php get_template_part("TempParts/Main/Breadcrumb/breadcrumb"); ?>
<!-- / end single_bar_line -->
<div id="single_main_line">
<div class="container clearfix">
<div class="row no-gutters">
<div class="single-main col ml-xl-2">
<div class="single-info heku-box2 no-gutters wow slideInRight" >
<div class="single-title"><?php echo get_the_title(); ?></div>
<div class="single-meta-row pt-3 pb-2 d-flex justify-content-between">
<ul class="single-meta-box">
<li class="single-date"><span class="icon iconfont icon-time-3"></span><?php echo date('F',get_the_time('U')) . ' ' . get_the_time(' jS Y'); ?></li>
<li class="single-eye"><span class="icon iconfont icon-a-13"></span><span><?php if(function_exists('the_views')) { the_views(); } ?> Views</span></li>
</ul>
<ul class="single-tags-box">
<?php
if (is_single()){
$tags = wp_get_post_tags(get_the_id());
$i = 0;
foreach ($tags as $tag ) {
$posts = get_posts( ['fields' => 'ids','posts_per_page' => -1,'post_type' => 'post','tax_query' => [['taxonomy' => 'post_tag','field'=> 'id','terms'=> $tag->term_taxonomy_id,],],] );
$thumb_url = "/tag/" . $tag->slug;
if( isset( $posts[0] ) &&( count($posts) == 1 ) ){
$thumb_url = get_permalink($posts[0]);
}
if( $i++ < 2 ){ ?>
<li class="single-tags-item" ><span class="icon iconfont icon-a-12"></span><a target="_blank" href="<?php echo $thumb_url; ?>"><?php echo $tag->name; ?></a></li>
<?php }
}
} ?>
</ul>
</div>
<div id="single_info_content" >
<div class="entry-content pt-2 pb-2">
<?php the_content(); ?>
<ul class="single-tags-box pt-2">
<?php
if (is_single()){
$tags = wp_get_post_tags(get_the_id());
$i = 0;
foreach ($tags as $tag ) {
$posts = get_posts( ['fields' => 'ids','posts_per_page' => -1,'post_type' => 'post','tax_query' => [['taxonomy' => 'post_tag','field'=> 'id','terms'=> $tag->term_taxonomy_id,],],] );
$thumb_url = "/tag/" . $tag->slug;
if( isset( $posts[0] ) &&( count($posts) == 1 ) ){
$thumb_url = get_permalink($posts[0]);
}
if( $i++ < 4 && $i > 1){ ?>
<li class="single-tags-item" ><span class="icon iconfont icon-a-12"></span><a target="_blank" href="<?php echo $thumb_url; ?>"><?php echo $tag->name; ?></a></li>
<?php }
}
} ?>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>