File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/scdc-marine/TempParts/Single/single-post.php
<?php
use Heku\HekuClass\View\Product;
/**
* 文章内容页
*/
global $is_from_show;
$is_from_show = true;
wp_enqueue_script( 'heku-viewer', HEKU_THEME_URI . '/Assets/js/viewer.min.js' );
$custom_inline_script = '// 内容图片 222点击放大, 元素框:id:product_single_main 高清图源:src(本身放大)
window.addEventListener("DOMContentLoaded", function () {
var single_info_galley = document.getElementById("product_single_main");
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_add_inline_script( 'heku-viewer', $custom_inline_script, 'after' );
$custom_tocbot_inline_script = '// 网站导航条自动悬浮设置 #heku_top_menu2
var id = 1;
$(".entry-content").children("h1,h2,h3,h4,h5").each(function () {
// .content 为正文容器的 class,根据自己的情况修改
var hyphenated = "mashiro-" + id;
$(this).attr("id", hyphenated);
id++;
});
tocbot.init({
// Where to render the table of contents.
tocSelector: ".toc-container",
// Where to grab the headings to build the table of contents.
contentSelector: ".entry-content",
// Which headings to grab inside of the contentSelector element.
headingSelector: "h2,h3,h4",
collapseDepth: 3,
headingsOffset: 100,
collapsibleClass: "is-collapsible",
isCollapsedClass: "is-collapsed",
scrollSmoothOffset: -100,
scrollSmoothDuration: 250,
// scrollEndCallback: function (e) {
// window.scrollTo(window.scrollX, window.scrollY - 180);
// },
orderedList: true,
});';
if(strpos(get_the_content(), 'hekutitle0') !== false){
wp_enqueue_script( 'heku-tocbot', HEKU_THEME_URI . '/Assets/js/tocbot.min.js' );
wp_add_inline_script( 'heku-tocbot', $custom_tocbot_inline_script, 'after' );
}
add_action('heku_footer_inline_js','footer_inline_js_html', 10);
function footer_inline_js_html(){
wp_print_scripts('heku-viewer');
wp_print_scripts('heku-tocbot');
}
$product_model = get_post_meta( get_the_ID(), 'product_model', true );
$banner_group = get_post_meta( get_the_ID(), 'product_imgs', true );
//var_dump(get_post_meta( get_the_ID(), 'home_parameters', true ));
//var_dump($product_model);
$brand_array = Product::get_product_brand( get_post_meta( get_the_ID(), 'product_brand_slider', true ));
$product_posts = get_post_meta( get_the_ID(), 'product_hot_post', true );
$product_news = get_post_meta( get_the_ID(), 'product_related_news', true );
?>
<!-- / 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="product_img_line">
<div class="container">
<div class="row no-gutters clearfix">
<div class="single-sidebar order-xl-first d-xl-block d-none sidebar-right mr-xl-4 clearfix">
<!-- / star single_bar_line -->
<?php get_template_part("TempParts/Main/Sidebar/sidebar"); ?>
<!-- / end single_bar_line -->
</div>
<div id="product_single_main" class="single-main col ml-xl-2">
<div class="single-top heku-box m-0 row wow fadeInUp clearfix">
<div class="product-img-left col">
<!-- star heku-top-img -->
<div id="Carousel_Product_Img" class="carousel slide carousel-slider" data-ride="carousel" >
<div id="viewer" class="carousel-inner product-img-inner heku-img-box heku-img-radius">
<!-- / start product-img-inner call --><?php
if(!empty($banner_group)){
$num = 0;
foreach ($banner_group as $key => $value) {
if(isset($value)){
$sss = get_post_meta($key,"_wp_attachment_image_alt",true);
//var_dump($sss ); ?>
<div class="carousel-item product-img-bg <?php echo (( $num == '0')? 'active' : '');?>" data-interval="4000"><?php
if($sss){ ?>
<div class="product-img-video" >
<video id="prouct_video_<?php echo $key;?>" class="video-js" playsinline="playsinline" controls preload="none" height="100%" width="100%" data-setup='{}' poster="<?php echo $value;?>">
<source src="<?php echo get_post_meta($key,"_wp_attachment_image_alt" )[0];?>" type="video/mp4">
<source src="<?php echo get_post_meta($key,"_wp_attachment_image_alt" )[0];?>" type="video/ogg">
</video>
</div><?php
}else{ ?>
<img class="" data-original="<?php echo $value;?>" src="<?php echo $value;?>" alt="<?php echo get_the_title();?>" ><?php
} ?>
</div><?php
$num ++;
}
}
} ?>
<!-- / end product-img-inner call -->
</div>
<div class="carousel-control-prev">
<a href="#Carousel_Product_Img" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
</div>
<ol class="carousel-indicators product-img-indicators justify-content-start">
<!-- / start product-img-indicators call --><?php
if(!empty($banner_group)){
$num = 0;
foreach ($banner_group as $key => $value) {
if(isset($value)){ ?>
<li data-target="#Carousel_Product_Img" data-slide-to="<?php echo $num;?>" class="col <?php echo (( $num == '0')? 'active' : '');?>" style="background:url(<?php echo $value;?>) no-repeat center;background-size: cover;"></li><?php
}
$num ++;
}
} ?>
<!-- / end product-img-indicators call -->
</ol>
<div class="carousel-control-next">
<a href="#Carousel_Product_Img" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
</div>
<!-- end heku-top-img -->
</div>
<div class="product-summary-right col-auto">
<!-- star heku-top-summary -->
<div id="Div_Product_Summary" class="product-summary">
<div class="product-summary-title"><span><?php echo get_the_title();?></span></div>
<div class="product-summary-detail">
<?php if($brand_array){ ?>
<div class="b mb-1">
<img class="sidebar-cat-img " src="<?php echo $brand_array['images']; ?>" alt="<?php echo $brand_array['title']; ?>" style="height: 36px;">
<span class="brand"><?php echo $brand_array['title']; ?></span>
</div>
<?php } ?>
<ul class="c mb-2">
<?php echo get_post_meta( get_the_ID(), 'home_parameters', true ); ?>
</ul>
</div>
<div class="product-summary-btn">
<a class="heku-btn heku-btn-white" href="#Heku_Form_Model" data-toggle="modal" data-target="#Heku_Form_Model">Request Quote</a>
<a class="heku-btn heku-btn-white contact-btn " href="#Heku_Form_Model" class="btn btn-primary2" data-toggle="modal" data-target="#Heku_Form_Model">Contact Us</a>
</div>
</div>
<!-- end heku-top-summary -->
</div>
</div>
<div class="single-info-main mt-4 heku-box wow fadeInUp clearfix">
<div class="single-info entry-content no-gutters">
<?php the_content(); ?>
</div>
</div>
<?php if( isset( $product_news[0] ) && ( count($product_news) > 0 ) ){ ?>
<div class="single-title hekutitle01 pt-3 pb-3 wow fadeInUp">
Related News & Service
</div>
<ul class="news-box news-box-1 archive-news row">
<?php foreach( $product_news as $post): ?>
<?php setup_postdata($post); ?>
<?php get_template_part("TempParts/Main/item-Template/item-news-1"); ?>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata();
} ?>
<?php if( isset( $product_posts[0] ) && ( count($product_posts) > 0 ) ){ ?>
<div class="single-title hekutitle01 pt-2 pb-3 wow fadeInUp">
Hot Sales Products
</div>
<ul class="row product-box product-box-1 mb-4 ">
<!-- end heku-top-menu -->
<?php foreach( $product_posts as $post): ?>
<?php setup_postdata($post); ?>
<?php get_template_part("TempParts/Main/item-Template/item-product2"); ?>
<?php endforeach; ?>
<!-- end heku-top-menu -->
</ul>
<?php wp_reset_postdata();
} ?>
</div>
</div>
</div>
</div>