[resolved] Main feed not showing custom posts (wp 3.1) (2 posts)

  1. Abdessamad Idrissi
    Posted 5 years ago #

    Is it possible to modify the type of posts shown by main wordpress's feed?

    to access the feed, I use in the header template:

    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php echo get_bloginfo_rss('rss2_url'); ?>" />

    I tried both adding filters and actions but nthing changed the posts in the generated feed; my post type is lbotika_ads but wp outputs only normal posts.

    so far I use

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( is_feed() )
    		$query->set( 'post_type', array( 'lbotika_ads' ) );
    	return $query;

    any hint?

  2. Abdessamad Idrissi
    Posted 5 years ago #

    i succeed to show custom post feeds by adding
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="feed/?post_type=lbotika_ads" /> to the header template.

    still to know if this is the right way to go or there's more "poetic" way to achieve such thing!

Topic Closed

This topic has been closed to new replies.

About this Topic