File: /www/wwwroot/wood-lk.cn/wp-content/themes/mlk/single-news.php
<?php
/*
Template Name: 新闻详情
Author: 畔游科技
Version: 1.0
*/
get_header(); ?>
<div class="container">
<div class="flex pages-wrap">
<div class="pages-left">
<div class="aside-nav">
<div class="flex aside-nav-title">
<h3>树屋鉴赏</h3>
</div>
<!-- ./ -->
<div class="aside-nav-current">
<ul>
<li class="on"><a href="<?php echo esc_url( home_url( '/' ) ); ?>">树屋案例</a></li>
</ul>
</div>
<!-- ./ -->
</div>
<!-- ./nav -->
<?php get_sidebar(); ?>
<!-- ./ -->
</div>
<!-- ./left -->
<div class="pages-right">
<div class="page-path">
当前位置:<a href="<?php echo esc_url( home_url( '/' ) ); ?>">首页</a> <b></b> <span>树屋案例</span>
</div>
<!-- ./ -->
<div class="pages-curcatagory">
<h3><i></i>树屋案例 </h3>
</div>
<!-- ./ -->
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="case-detail-title">
<h3><?php the_title(); ?></h3>
<p><span><?php the_time('Y-m-d'); ?></span><span>浏览次数:<?php get_post_views($post -> ID); ?></span></p>
</div>
<!-- ./ -->
<div class="case-detail-content">
<!-- *********************** -->
<?php if (get_field('swipers')) { ?>
<?php $my_arr = get_field('swipers'); ?>
<div class="pages-swipers">
<div class="gallery-top">
<div class="swiper-container">
<div class="swiper-wrapper">
<?php
for($i=0;$i<count($my_arr);$i++) {
$arr = $my_arr[$i];
$n=$i+1;
echo "<div class='swiper-slide'><div class='gallery-top-img'><img src='".$arr[url]. "' /></div></div>";
}
?>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
</div>
<!-- ./top -->
<div class="gallery-thumbs">
<div class="swiper-container">
<div class="swiper-wrapper">
<?php
for($i=0;$i<count($my_arr);$i++) {
$arr = $my_arr[$i];
$n=$i+1;
echo '<div class="swiper-slide background" style="background-image:url('.$arr[url].')"></div>';
}
?>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div>
</div>
<!-- ./thumbs -->
</div>
<?php } ?>
<!-- ************************* -->
<?php the_content(); ?>
</div>
<!-- ./ -->
<div class="nextpage">
<ul class="clearfix">
<?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('上一篇: %link','%title',true);} else { echo "已是最新文章";} ?></li>
<li class="py_previou"><?php if (get_previous_post($categoryIDS)) { previous_post_link('下一篇: %link','%title',true);} else { echo "已是最后文章";} ?></li>
</ul>
</div>
<!-- ./ -->
</div>
<?php endwhile; endif; ?>
<!-- ./right -->
</div>
</div>
<link href="https://cdn.bootcdn.net/ajax/libs/Swiper/4.5.0/css/swiper.min.css" rel="stylesheet">
<script src="https://cdn.bootcdn.net/ajax/libs/Swiper/4.5.0/js/swiper.min.js"></script>
<script>
if($(".aside-nav-current ul li").hasClass("current_page_item")) {
var _this = $(".aside-nav-current ul li");
_this.removeClass('on');
}
var galleryThumbs = new Swiper('.gallery-thumbs .swiper-container', {
spaceBetween: 10,
slidesPerView: 'auto',
freeMode: true,
watchSlidesVisibility: true,
watchSlidesProgress: true,
});
var galleryTop = new Swiper('.gallery-top .swiper-container', {
spaceBetween: 10,
// lazy: true,
navigation: {
nextEl: '.gallery-top .swiper-button-next',
prevEl: '.gallery-top .swiper-button-prev',
},
thumbs: {
swiper: galleryThumbs
}
});
</script>
<?php get_footer(); ?>