我很漂亮在WP新,所以请原谅我我的无知即时通讯尝试学习。搜索post_like +搜索分类复选框在一个循环
所以我有两个Wp_Query(通过在搜索栏中输入和搜索分类复选框进行搜索),我不知道如何混合它们...如果一个作品第二不要和它的cricle。
<?php
global $search_ingr;
if(isset($search_ingr)) {
global $loop;
} else {
$query_params = getQueryParams();
if(isset($query_params['search'])) {
$query_params['post_title_like'] = $query_params['search'];
unset($query_params['search']);
}
$loop = new WP_Query(array(
'numberposts' => 60,
'posts_per_page' => 60,
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'products',
'post_status' => 'publish'
));
}
?>
<?php if(isset($search)): ?>
<div class="search-matches"><h4>Wyniki wyszukiwania:</h4><hr></div>
<?php endif; ?>
<?php if ($loop->have_posts()) :?>
<?php while($loop->have_posts()) : $loop->the_post(); ?>
<span class="tooltip tooltip-effect-4">
<span class="tooltip-item">
<div class="product">
<a href="<?php the_permalink(); ?>">
<div class="product-thumbnail"><span class="helper"></span><?php the_post_thumbnail(); ?></div>
<div class="product-name"><?php the_title(); ?></div>
</a>
</div>
</span>
<a href="<?php the_permalink(); ?>">
<span class="tooltip-content clearfix">
<?php the_post_thumbnail(); ?>
<span class="tooltip-text"><?php the_title(); ?></span>
</span>
</a>
</span>
<?php endwhile; ?>
<?php endif; ?>
很长的和平代码,我粘贴循环以及以上,我有搜索框和分类列表。
此外,当我删除此:
// $loop = new WP_Query(array(
// 'numberposts' => 60,
// 'posts_per_page' => 60,
// 'orderby' => 'title',
// 'order' => 'ASC',
// 'post_type' => 'products',
// 'post_status' => 'publish'
// ));
两个搜索的伟大工程(但我无法控制职务序列和职位的数量)。 对此有何帮助?