File: /www/wwwroot/www.sceybwg.com/wp-content/themes/Modular/template/module-page/theme-post-2.php
<?php
/**
* Template: 文章-2
* @Author: 大胡子
* @Email: dahuzi@xintheme.com
* @Link: www.xintheme.com
* @Date: 2023-08-01 07:27:28
* @Last Modified by: dahuzi
* @Last Modified time: 2024-08-28 16:25:17
*/
if(!empty($module_content)){?>
<div class="section theme-post swiper-parent <?php echo $wow_style;?>">
<div class="container">
<?php
if( !empty($module_setting['title_display']) ){?>
<div class="post-box-heading">
<div>
<?php
if( !empty($module_title) ){
echo '<h2>'.$module_title.'</h2>';
}
if( !empty($module_desc) ){
echo '<p>'.$module_desc.'</p>';
}
?>
</div>
<?php
if (!empty($module_content['more_url']) &&
!empty($module_content['more_btn_text']) &&
!empty($module_content['more_btn_url'])) {
printf(
'<a class="btn-more" href="%s">%s<i class="ri-arrow-right-line"></i></a>',
esc_url($module_content['more_btn_url']),
esc_html($module_content['more_btn_text'])
);
}
?>
</div>
<?php }
// 限制图片高度
$post_thumb_pc_h = !empty($module_content['post_thumb_pc_h']) ? '--post_thumb_pc_h:' . intval($module_content['post_thumb_pc_h']) . 'px;' : '--post_thumb_pc_h:auto;';
$post_thumb_mb_h = !empty($module_content['post_thumb_mb_h']) ? '--post_thumb_mb_h:' . intval($module_content['post_thumb_mb_h']) . 'px;' : '--post_thumb_mb_h:auto;';
$post_thumb_h = ($post_thumb_pc_h || $post_thumb_mb_h) ? sprintf('style="%s%s"', $post_thumb_pc_h, $post_thumb_mb_h) : '';
?>
<div style="margin-right:calc((100vw - 100%) / -2);">
<div class="swiper" data-uc-swiper="items: 1.2; gap: 16; loop: true; next: .swiper-nav-next; prev: .swiper-nav-prev;" data-uc-swiper-s="items: 2.3; gap: 24;" data-uc-swiper-m="items: 3.5; gap: 24;" data-uc-swiper-l="items: 3.5; gap: 32;">
<div class="swiper-wrapper post-box-list" <?php echo $post_thumb_h; ?>>
<?php
// 指定文章处理
if (!empty($module_content['post_id']) && $module_content['cat_post'] === 'post_id') {
foreach ($module_content['post_id'] as $post_id) {
$post = get_post($post_id); // 获取单篇文章
if ($post) {
setup_postdata($post);
echo '<div class="swiper-slide">';
include TEMPLATEPATH.'/template/loop/list-blog.php';
echo '</div>';
}
}
wp_reset_postdata();
}
// 对应分类文章处理
if (!empty($module_content['cat_id']) && $module_content['cat_post'] === 'cat_id') {
$args = [
'posts_per_page' => $module_content['post_per_page'] ?? 6,
'ignore_sticky_posts' => true,
'cat' => $module_content['cat_id'],
];
$cat_posts_query = new WP_Query($args);
if ($cat_posts_query->have_posts()) {
while ($cat_posts_query->have_posts()) {
$cat_posts_query->the_post();
echo '<div class="swiper-slide">';
include TEMPLATEPATH.'/template/loop/list-blog.php';
echo '</div>';
}
wp_reset_postdata();
} else {
echo '<p style="width:100%;text-align:center;">' . __('暂无相关内容', 'modular_theme') . '</p>';
}
}
?>
</div>
</div>
</div>
<div class="swiper-navigation">
<div class="navigation-wrapper">
<a href="#" class="swiper-nav swiper-nav-prev">
<i class="ri-arrow-left-line"></i>
</a>
<a href="#" class="swiper-nav swiper-nav-next">
<i class="ri-arrow-right-line"></i>
</a>
</div>
<?php
if (!empty($module_content['more_url']) &&
!empty($module_content['more_btn_text']) &&
!empty($module_content['more_btn_url'])) {
printf(
'<a class="btn-more" href="%s">%s<i class="ri-arrow-right-line"></i></a>',
esc_url($module_content['more_btn_url']),
esc_html($module_content['more_btn_text'])
);
}
?>
</div>
</div>
</div>
<?php }?>
<?php
//echo wpjam_print_r( $module_setting );
//echo wpjam_print_r( $module_content );
//echo wpjam_print_r( $module_style );