File: /www/wwwroot/gxdaosen.net/wp-content/themes/simplepark/move/index/pic.php
<div class="swiper-container">
<div class="swiper-wrapper">
<?php
$hot_cat= get_option('mytheme_hot_cat');//获取分类别名为 wordpress 的分类数据
$cat_links=get_category_link($hot_cat->term_id); // 通过$cat数组里面的分类id获取分类链接
$word_t1=get_option('mytheme_word_t1');
$posts = get_posts( "category=($hot_cat)&numberposts=30" ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<div class="swiper-slide">
<img id="phone_pic" src="<?php echo get_post_meta($post->ID, 'phone_pic',true); ?>"/>
</div>
<?php endforeach; ?>
<?php else : ?>
<?php endif; ?>
</div>
<div class="pagination"></div>
</div>
<script>
var mySwiper = new Swiper('.swiper-container',{
pagination: '.pagination',
paginationClickable: true
})
</script>