开发者

How to show WordPress custom post type entries in a feed?

开发者 https://www.devze.com 2023-01-10 02:59 出处:网络
I cr开发者_运维问答eated a custom post type called article. I can create articles and everything is working fine. However, I have questions on the feeds.

I cr开发者_运维问答eated a custom post type called article. I can create articles and everything is working fine. However, I have questions on the feeds.

1) How do I see the latest articles I created in a feed?

2) How do I see all the blog posts and articles all in one feed?


You can add this code to your functions.php file

function myfeed_request($qv) 
{
   if (isset($qv['feed']) && !isset($qv['post_type']))
   {
     $qv['post_type'] = get_post_types($args = array(
                'public'   => true,
                '_builtin' => false
     ));
     array_push($qv['post_type'],'post');
     return $qv;
   }
}
add_filter('request', 'myfeed_request');

Check out this page here for more details

0

精彩评论

暂无评论...
验证码 换一张
取 消