File: /www/wwwroot/www.213n.cn/wp-content/themes/rk-blogger/search.php
<?php
/**
* The template for displaying archive pages
*
* Author: wbolt team
* Author URI: https://www.wbolt.com
*/
get_header();
$have_posts = have_posts();
wb_breadcrumbs(false, false, 'pw');
?>
<div class="container container-search pw">
<div class="main main-list">
<div class="header-list">
<div class="title-list">
<?php
global $wp_query;
$item_count = number_format($wp_query->found_posts);
$item_count = $item_count > 0 ? '当前搜索词查找到共' . $item_count . '个相关结果' : '';
?>
<h1>搜索:<?php echo '<span>' . get_search_query() . '</span>'; ?></h1>
<div class="description"><?php echo $item_count; ?></div>
</div>
<?php
$list_display_mode = wb_opt('list_display_mode');
$mode_list = list_mode();
if ($list_display_mode == 0 && $have_posts) : ?>
<div class="ctrl-area" id="J_switchListModeBtns">
<a class="ctrl-item<?php echo $mode_list == 'a' ? ' current' : ''; ?>" data-mode="a" title="卡片模式"><?php echo wbolt_svg_icon('wbsico-list-a'); ?></a>
<a class="ctrl-item<?php echo $mode_list == 'b' ? ' current' : ''; ?>" data-mode="b" title="图文模式"><?php echo wbolt_svg_icon('wbsico-list-b'); ?></a>
</div>
<?php endif; ?>
</div>
<?php if ($have_posts) : ?>
<?php echo wb_insert_ad_block('list_title', 'adbanner-block under-list-title'); ?>
<div class="articles-list with-list-mode list-mode-<?php echo $mode_list; ?>" id="J_postList">
<?php
$postIndex = 0;
$adIndex = rand(3, 8);
$hasListAD = wb_opt('ads.list.type') || wb_opt('ads.list_b.type');
while (have_posts()) : the_post();
get_template_part('template-parts/content', get_post_format());
if ($hasListAD && $postIndex == $adIndex) {
get_template_part('template-parts/content', 'list-ad');
}
$postIndex++;
endwhile;
?>
</div>
<div class="loading-bar"></div>
<?php
wbolt_the_posts_pagination();
?>
<?php else :
get_template_part('template-parts/content-none', 'none');
endif; ?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>