[英]Working with Function have_posts from WordPress
我正在使用WordPress codex中的函数have_posts。 我想要做的是:
while ($content_query->have_posts()) {
$content_query->the_post();
if(strpos(the_title(),'Garajes Gran')===false){
global $post;
include($item_template);
}
}
所以我得到了包含Garajes Gran名字的完整名单,而不是没有名字Garajes Gran的名单,我做错了什么? doesn't do what it means?. 而不是寻找字符串Garajes Gran的第一个位置,它打印所有名称,所以为什么不做它意味着什么?
提前致谢。
尝试下面的代码使用'get_the_title()'而不是'the_title()'。
if(strpos(get_the_title( get_the_ID() ),'Garajes Gran')===false){
global $post;
include($item_template);
}
我希望这对你有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.