File: /www/wwwroot/q.autos58.cn/wp-content/themes/kong20/index.php
<?php get_header()?>
<div class="section-bg">
<div class="container">
<?php
$index_sticky = _hua('index-swiper-slide-t');
$category_mode = $index_sticky['category_mode'] ?? 'all';
$specific_cats = isset($index_sticky['specific_categories']) ? $index_sticky['specific_categories'] : array();
$orderby = $index_sticky['orderby'] ?? 'date';
$show_sticky_only = $index_sticky['get_is_zd'] ?? true;
?>
<?php
$args = array(
'posts_per_page'=>1,
'orderby' => $orderby,
'ignore_sticky_posts' => 1,
);
if ($category_mode === 'specific' && !empty($specific_cats)) {
$args['category__in'] = $specific_cats;
}
if ($show_sticky_only) {
$sticky_ids = get_option('sticky_posts');
$args['post__in'] = !empty($sticky_ids) ? $sticky_ids : array(0);
}
$custom_query = new WP_Query(handle_views_orderby($args));
?>
<div class="index-important">
<?php while($custom_query->have_posts()):$custom_query->the_post(); ?>
<h2><a href="<?php the_permalink();?>" target="_blank"><?php the_title();?></a></h2>
<?php endwhile;wp_reset_query();?>
</div>
<div class="row g-2 g-md-3 g-lg-4">
<div class="col-lg-8 col-sm-12">
<div class="section-swiper">
<div class="swiper mySwiper">
<div class="swiper-wrapper">
<?php
$index_sticky = _hua('index-swiper-slide');
$category_mode = $index_sticky['category_mode'] ?? 'all';
$specific_cats = isset($index_sticky['specific_categories']) ? $index_sticky['specific_categories'] : array();
$orderby = $index_sticky['orderby'] ?? 'date';
?>
<?php
$args = array(
'posts_per_page'=>5,
'orderby' => $orderby,
'ignore_sticky_posts' => 1,
);
if ($category_mode === 'specific' && !empty($specific_cats)) {
$args['category__in'] = $specific_cats;
}
$custom_query = new WP_Query(handle_views_orderby($args));
?>
<?php while($custom_query->have_posts()):$custom_query->the_post(); ?>
<div class="swiper-slide">
<a href="<?php the_permalink();?>"><img src="<?php echo _get_post_thumbnail_url(); ?>"></a>
<div class="slide-text">
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
</div>
</div>
<?php endwhile;wp_reset_query();?>
</div>
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-pagination"></div>
</div>
</div>
</div>
<div class="col-lg-4 col-sm-12">
<div class="index-news tn2">
<ul>
<?php
$index_sticky = _hua('index-swiper-slide-r');
$category_mode = $index_sticky['category_mode'] ?? 'all';
$specific_cats = isset($index_sticky['specific_categories']) ? $index_sticky['specific_categories'] : array();
$orderby = $index_sticky['orderby'] ?? 'date';
?>
<?php
$args = array(
'posts_per_page'=>4,
'orderby' => $orderby,
'ignore_sticky_posts' => 1,
);
if ($category_mode === 'specific' && !empty($specific_cats)) {
$args['category__in'] = $specific_cats;
}
$custom_query = new WP_Query(handle_views_orderby($args));
?>
<?php while($custom_query->have_posts()):$custom_query->the_post(); ?>
<li><a href="<?php the_permalink();?>" target="_blank"><?php the_title();?></a></li>
<?php endwhile;wp_reset_query();?>
</ul>
</div>
</div>
</div>
</div>
</div>
<?php
$module_home = _hua('home_mode');
if (!is_array($module_home)) {
echo '<h2 style=" text-align: center; margin: 0 auto; padding: 60px; ">获取首页模块数据失败,请检查!</h2>';
} else {
$enabled = isset($module_home['enabled']) ? $module_home['enabled'] : [];
if (empty($enabled)) {
echo '<h2 style=" text-align: center; margin: 0 auto; padding: 60px; ">暂无,请前往后台-主题设置-设置首页模块!</h2>';
} else {
foreach ($enabled as $key => $value) {
get_template_part('template/home-mode/' . $key);
}
}
get_template_part('template/home-mode/default');
}
?>
<?php
$sql = $wpdb->prepare(
"SELECT * FROM {$wpdb->links} WHERE link_visible = 'y' ORDER BY link_id LIMIT 0, 40",
$wpdb->links
);
$resul = $wpdb->get_results($sql);
if ($wpdb->last_error) {
error_log('友情链接查询出错: '. $wpdb->last_error);
} else {
if (!empty($resul)) :
?>
<?php if( _hua('get_is_links') ){ ?>
<div class="section-bg">
<div class="container">
<div class="links-a">
<div class="title1"><span>友情链接</span></div>
<p>
<?php
foreach ($resul as $key => $item) {
$link_url = esc_url($item->link_url);
$link_name = esc_html($item->link_name);
echo '<a target="_blank" href="'. $link_url . '">'. $link_name . '</a>';
}
?>
</p>
</div>
</div>
</div>
</div>
<?}?>
<?php
endif;
}
?>
<?php get_footer()?>
<link rel='stylesheet' href='<?php bloginfo('template_url'); ?>/css/swiper-bundle.min.css' media='all' />
<script src="<?php bloginfo('template_url'); ?>/js/swiper-bundle.min.js"></script>
<script language="javascript">
var swiper = new Swiper(".mySwiper", {
loop: true,
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
pagination: {
el: ".swiper-pagination",
clickable: true,
},
});
</script>
</body>
</html>