最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

loop - Display all posts from specific category and CPT

programmeradmin2浏览0评论

Currently, we are getting all posts from a specific category using the following:

$args = array(
    'post_type' => array('post'),
    'cat' => 1247,
    'posts_per_page' => 4
);

What we'd like to do is get all posts from cat 1247 and also from custom post type 'videos', such as:

$args = array(
    'post_type' => array('post', 'videos'),
    'cat' => 1247,
    'posts_per_page' => 4
 );

However, as none of the posts in 'videos' are from category '1247', it's only showing posts from '1247', however I can't seem to find a category for posts in video?

How would we go about achieving what we need to achieve?

发布评论

评论列表(0)

  1. 暂无评论