Php 从标题中基于查询的关键字中排除帖子
我有一个标准查询,根据视图的数量显示帖子Php 从标题中基于查询的关键字中排除帖子,php,wordpress,Php,Wordpress,我有一个标准查询,根据视图的数量显示帖子 <?php $cat_id='-8';//the category ID $limit = get_option('posts_per_page'); query_posts(array( 'showposts'=>32,'more' => $more = 0, 'v_sortby' => 'views', 'v_orderby' => 'DESC', 'v_outtype' => 'content', 'v_tim
<?php $cat_id='-8';//the category ID
$limit = get_option('posts_per_page');
query_posts(array(
'showposts'=>32,'more' => $more = 0,
'v_sortby' => 'views',
'v_orderby' => 'DESC',
'v_outtype' => 'content',
'v_timespan' => 'total',
'paged' => $paged
)); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
您的查询数组看起来像是保存了一个查询参数。 我不确定哪个参数在“order by”和limit语句之前最后出现。但是,假设v_timespan是最后一个条件,并且直接使用这些值(无需过滤),我建议将其更改为(不影响实际查询字符串-代码中未显示该字符串):
不幸的是,上面的代码没有产生任何结果。但是您的代码看起来像一个SQL查询。上面只是一个常规的wordpress查询,然后循环。
if(strpos(get_the_title(), 'metal') === false) {
// Title does not contain metal
}
array(
'showposts'=>32,'more' => $more = 0,
'v_sortby' => 'views',
'v_orderby' => 'DESC',
'v_outtype' => 'content',
'v_timespan' => "total and title not like '%metal%'";
'paged' => $paged
))