WordPress.org

Support

Support » Themes and Templates » [Resolved] Main feed not showing custom posts (wp 3.1)

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

  • 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?

Viewing 1 replies (of 1 total)
  • 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!

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Main feed not showing custom posts (wp 3.1)’ is closed to new replies.