File: /www/wwwroot/www.sceytyg.com/wp-content/themes/Zing-Pro/single/single-news.php
<?php
get_header();
$category = get_the_category();
if($category[0]){
$catid = $category[0]->term_id;
}
$category_data = get_term_meta( $catid, '_prefix_taxonomy_options', true );
$cat_banner_img = isset( $category_data['cat_banner_img']['url'] ) ? $category_data['cat_banner_img']['url'] : '';
$post_extend = get_post_meta( get_the_ID(), 'extend_info', true );
$no_sidebar = isset($post_extend['no_sidebar']) ?$post_extend['no_sidebar'] : '';
$post_header_banner = xintheme('post_header_banner');
$no_sidebar_all = xintheme('post_no_sidebar_all');
$single_ad = xintheme('single_ad');?>
<?php while( have_posts() ): the_post(); ?>
<?php if( $cat_banner_img && !$post_header_banner ){?>
<div class="module-default">
<div class="responsive-carousel carousel clearfix">
<div class="carousel-item">
<img loading="lazy" src="<?php echo $cat_banner_img;?>">
</div>
</div>
</div>
<?php }?>
<section class="main">
<div class="page-width clearfix">
<section class="content float-right<?php if( $no_sidebar==true || $no_sidebar_all ) : ?> no_sidebar<?php endif;?>">
<div class="breadcrumbs">
<?php if (function_exists('get_breadcrumbs')){get_breadcrumbs(); } ?>
</div>
<div class="content-box">
<div class="article-detail">
<div class="article-title">
<h1><?php the_title_attribute(); ?></h1>
</div>
<div class="entry-meta">
<span>
<i class="fa fa-folder"></i> <?php the_category(', ') ?>
</span>
<?php if( xintheme('xintheme_single_time') ){ ?>
<span>
<i class="fa fa-calendar"></i> <?php echo dahuzi_post_time();?>
<?php //echo get_the_date('Y-m-d H:i'); ?>
</span>
<?php }?>
<?php if( xintheme('xintheme_single_views') ){ ?>
<span>
<i class="fa fa-eye"></i> <?php post_views('',''); ?>
</span>
<?php }?>
<?php
$single_source = isset($post_extend['single_source']) ?$post_extend['single_source'] : '';
$single_source_url = isset($post_extend['single_source_url']) ?$post_extend['single_source_url'] : '';
if( $single_source ){
if( $single_source_url ){?>
<span>来源:<a href="<?php echo $single_source_url;?>" target="_blank" rel="nofollow"><?php echo $single_source;?></a></span>
<?php }else{?>
<span>来源:<?php echo $single_source;?></span>
<?php }
}?>
</div>
<div class="article-content-wrapper">
<div class="article-content">
<div class="qhd-content" id="wzzt">
<?php if( !empty($single_ad['single_ad_top']['url']) ){?>
<div class="single-top">
<a href="<?php echo $single_ad['single_ad_top_url'];?>" target="_blank" rel="nofollow">
<img loading="lazy" src="<?php echo $single_ad['single_ad_top']['url'];?>" alt="<?php echo $single_ad['single_ad_top']['title'];?>">
</a>
</div>
<?php }?>
<?php the_content(); ?>
<div class="entry-tags">
<?php the_tags(__('Tags: ', 'dahuzi_theme'), ' · ', ''); ?>
</div>
<?php if( !empty($single_ad['single_ad_bottom']['url']) ){?>
<div class="single-bottom">
<a href="<?php echo $single_ad['single_ad_bottom_url'];?>" target="_blank" rel="nofollow">
<img loading="lazy" src="<?php echo $single_ad['single_ad_bottom']['url'];?>" alt="<?php echo $single_ad['single_ad_bottom']['title'];?>">
</a>
</div>
<?php }?>
</div>
</div>
<?php endwhile; ?>
<?php if( xintheme('xintheme_single_share') ){?>
<div class="detail-bottom">
<div class="share-links-wrap">
<p class="text-header small"><?php esc_html_e( 'Share: ', 'dahuzi_theme' ); ?></p>
<ul class="share-links hoverable">
<?php
if( get_locale() != 'zh_CN' ){
$links = dahuzi_sharing_links();
$options = xintheme( 'dahuzi_sharing_links', array( 'facebook', 'twitter', 'pinterest', 'linkedin', 'whatsapp' ) );
foreach ( $options as $option ) : ?>
<li><a class="<?php echo esc_attr( $option ); ?>" href="<?php echo esc_attr( $links[ $option ]['link'] ); ?>" target="_blank">
<i class="fa fa-<?php echo esc_attr( $links[ $option ]['icon'] ); ?>"></i>
</a></li>
<?php
endforeach;
}else{
$post_image = post_thumbnail(260, 260);
$qrcode = ''.get_bloginfo('template_directory').'/public/qrcode?data='.get_the_permalink().'';
echo '<li><a class="qq-share" href="' . esc_url(get_permalink()) . '" title="分享到QQ" data-title="' . esc_attr(get_the_title()) . '" data-image="' . esc_attr($post_image) . '" data-excerpt="'. get_the_excerpt() .'"><i class="iconfont icon-QQ"></i></a></li>';
echo '<li><a class="weixin-share" href="' . $qrcode . '" title="分享到微信" data-image="' . esc_attr($post_image) . '"><i class="iconfont icon-weixin"></i></a></li>';
echo '<li><a class="weibo-share" href="' . esc_url(get_permalink()) . '" title="分享到新浪微博" data-title="' . esc_attr(get_the_title()) . '" data-image="' . esc_attr($post_image) . '" data-excerpt="'. get_the_excerpt() .'"><i class="iconfont icon-weibo"></i></a></li>';
}?>
</ul>
</div>
</div>
<?php }?>
</div>
</div>
</div>
<?php if( xintheme('xintheme_single_prev') ){ //判断是否开启上一篇下一篇 开始?>
<div class="entry-page">
<?php //获取同分类下的上一篇 下一篇
$categories = get_the_category();
$categoryIDS = array();
foreach ($categories as $category) {
array_push($categoryIDS, $category->term_id);
}
$categoryIDS = implode(",", $categoryIDS);
?>
<?php
$prev_post = get_previous_post( $categoryIDS );
if(!empty($prev_post)):?>
<div class="entry-page-prev">
<a href="<?php echo get_permalink($prev_post->ID);?>" title="<?php echo $prev_post->post_title;?>"><span><?php echo $prev_post->post_title;?></span></a>
<div class="entry-page-info">
<span class="pull-left">« <?php esc_html_e( 'Previous post', 'dahuzi_theme' ); ?></span>
<span class="pull-right"><?php echo dahuzi_post_time();?></span>
</div>
</div>
<?php endif;?>
<?php
$next_post = get_next_post( $categoryIDS );
if(!empty($next_post)):?>
<div class="entry-page-next">
<a href="<?php echo get_permalink($next_post->ID);?>" title="<?php echo $next_post->post_title;?>"><span><?php echo $next_post->post_title;?></span></a>
<div class="entry-page-info">
<span class="pull-right"><?php esc_html_e( 'Next post', 'dahuzi_theme' ); ?> »</span>
<span class="pull-left"><?php echo dahuzi_post_time();?></span>
</div>
</div>
<?php endif;?>
</div>
<?php } //判断是否开启上一篇下一篇 结束?>
<?php if( dahuzi('post_contact') ){
get_template_part( 'template-parts/dahuzi_contact');
}?>
<?php if( xintheme('xintheme_single_comments') ){
comments_template( '', true );
}?>
<?php if( xintheme('xintheme_single_related') ){
get_template_part( 'template-parts/related');
}?>
</section>
<?php if( $no_sidebar==false && $no_sidebar_all==false ) : get_sidebar(); endif;?>
</div>
</section>
<?php get_footer(); ?>