Wordpress WP_Query呼叫帖子和页面 [英] Wordpress WP_Query call posts AND pages

查看:117
本文介绍了Wordpress WP_Query呼叫帖子和页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个功能滑块,以绘制标记为功能"的帖子

I have a feature slider set up that draws in posts that are tagged 'feature'

$my_query = new WP_Query(array(
  'showposts' => 3,
  'tag'  => 'feature' ));

是否可以绘制帖子和页面? 我知道您可以使用'post_type'=>'page'绘制页面,但是可以将两者混合吗?

Is is possible to draw in posts AND pages? I know you can draw pages with 'post_type'=>'page' but can you mix the two?

推荐答案

@fivedigit 谢谢,但是我同意了结束:

@fivedigit Thanks but I went with this in the end:

$my_query = new WP_Query(array(
    'post_type' => array('any'),
    'tag'  => 'feature'
));

尽管您的版本将来可能会派上用场!

Although your version may come in handy in the future!

这篇关于Wordpress WP_Query呼叫帖子和页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆