File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/scdc-marine/TempParts/Single/single-news-2.php
<?php
use Heku\HekuClass\View\News;
/**
* 新闻详情页
*/
$custom_viewer_inline_script = '
window.addEventListener("DOMContentLoaded", function () {
var single_info_galley = document.getElementById("single_info_content");
var single_info_viewer = new Viewer(single_info_galley, {
url: "src",
toolbar:{
oneToOne: false,
play: false,
prev: function() {
single_info_viewer.prev(true);
},
next: function() {
single_info_viewer.next(true);
},
},
title:false,
});
});';
wp_enqueue_script( 'heku-viewer', HEKU_THEME_URI . '/Assets/js/viewer.min.js' );
wp_add_inline_script( 'heku-viewer', $custom_viewer_inline_script, 'after' );
//the_content();
add_action('heku_footer_inline_js','footer_inline_js_html', 10);
function footer_inline_js_html(){
wp_print_scripts('heku-viewer');
}
?>
<!-- / 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="single-main col">
<div class="single-info p-0 heku-box2 no-gutters wow fadeInUp">
<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 id="news_pre_next" class="news-pre-next row justify-content-between wow fadeInUp ">
<?php
$prev_post = get_previous_post();
if (!empty($prev_post)): ?>
<div class="news-pre col">
<div class="news-pre-next-info heku-box">
<a href="<?php echo get_permalink($prev_post->ID); ?>">
<div class="next-jt">
<span class="icon iconfont icon-left"></span>
</div>
<div class="news-pre-next-tit">
<span><?php echo $prev_post->post_title; ?></span>
</div>
<div class="news-pre-next-time">
<div class="news-time-ymd"><span class="icon iconfont icon-time-3"> <?php echo date(' F',get_the_time('U',$prev_post->ID)) . ' ' . get_the_time('jS Y',$prev_post->ID); ?></div>
</div>
</a>
</div>
</div>
<?php endif; ?>
<?php
$next_post = get_next_post();
if (!empty($next_post)): ?>
<div class="news-next col">
<div class="news-pre-next-info heku-box">
<a href="<?php echo get_permalink($next_post->ID); ?>">
<div class="news-pre-next-tit">
<span><?php echo $next_post->post_title; ?></span>
</div>
<div class="news-pre-next-time">
<div class="news-time-ymd"> <span class="icon iconfont icon-time-3"> <?php echo date(' F',get_the_time('U',$next_post->ID)) . ' ' . get_the_time('jS Y',$next_post->ID); ?> </div>
</div>
<div class="next-jt">
<span class="icon iconfont icon-right"></span>
</div>
</a>
</div>
</div>
<?php endif; ?>
</div>
<ul class="news—item-ul_1 no-gutters row">
<div class="single-title pt-4 pb-3">
Hot Sales Products
</div>
<!-- end heku-top-menu -->
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part("TempParts/Main/item-Template/item-product"); ?>
<?php endwhile; wp_reset_query(); ?>
<!-- end heku-top-menu -->
</ul>
</div>
<div class="single-sidebar order-xl-first sidebar-right mr-xl-4">
<!-- / star single_bar_line -->
<?php //get_template_part("TempParts/Main/Sidebar/sidebar"); ?>
<!-- / end single_bar_line -->
</div>
</div>
</div>
<style>
/* ----------------------------------------------------
12) start #archive-news 新闻中心
------------------------------------------------------- */
.news—item-ul_1 .news-item{box-shadow: 0px 2px 5px rgba(0,0,0,0.26);background: #f7f7f7;border-radius: 8px;margin: 0px 0px 25px 0px;position: relative;}
.news—item-ul_1 .news-item .news-img{width: 100%;border-radius: 6px;overflow: hidden;height: 15rem;}
.news—item-ul_1 .news-item .news-time{right: 10px;position: absolute;}
.news—item-ul_1 .news-item .news-tit a{font-size: 24px;color: #000000;line-height: 60px;height: 76px;overflow: hidden;font-weight: 600;letter-spacing: 1px;}
.news—item-ul_1 .news-item .news-tit a span{display: inline-block;vertical-align: middle;line-height: 38px;}
.news—item-ul_1 .news-item .news-summary span{color: #898b8e;}
.news—item-ul_1 .news-item .news-time-d{font-size: 50px;line-height: 50px;font-weight: bolder;}
.news—item-ul_1 .news-item:hover .news-tit a span{color: #235bb8;}
.news—item-ul_1 .news-item:hover .heku-btn{color: #ffffff;font-weight: bold;border: 0px solid #ffffff;background: rgb(35 91 184);}
.news—item-ul_1 .news-item:hover .news-time{color: #235bb8;}
.news—item-ul_1 .news-item .news-comt{padding-left: 40px;}
.news—item-ul_1 .news-item:hover{background: #ddd}
/* --- 1) å°äºŽ780尺寸 --- sm --- */
@media only screen and (max-width: 768px){
.news-item .news-tit a{font-size: 18px;height: 64px;}
.news-item .news-tit a span{line-height: 24px;color: #235bb8;}
.news-item .news-summary span{font-size: 14px;}
.news-item .news-comt{padding-left: 0px;}
}
/* --- 0) 手机 --- mobile --- */
@media (max-width: 576px){
.news-item .news-tit a{font-size: 18px;height: 48px;}
.news-item .news-tit a span{line-height: 24px;color: #235bb8;}
.news-item .news-summary span{font-size: 14px;}
.news-item .news-comt{padding-left: 0px;}
}
/* --- 2) 大于768px尺寸 --- md --- */
@media(min-width:768px){
.news-item .news-tit a{font-size: 18px;height: 64px;}
.news-item .news-tit a span{line-height: 32px;}
.news-item .news-comt{padding-left: 30px;}
}
/* --- 3) 大于992px尺寸 --- lg --- */
@media(min-width:992px){
.news-item .news-tit a{font-size: 20px;height: 64px;}
.news-item .news-tit a span{line-height: 32px;}
.news-item .news-comt{padding-left: 30px;}
}
/* --- 4) 大于1200尺寸时候使用 --- xl --- */
@media(min-width:1200px){
.news-item .news-tit a{font-size: 24px;height: 76px;}
.news-item .news-tit a span{line-height: 38px;}
.news-item .news-comt{padding-left: 40px;}
}
/* ----------------------------------------------------
30-40) end #archive 60-79分类 åˆ†ç±»é¡µæ ·å¼
------------------------------------------------------- */
</style>