Return to Snippet

Revision: 68921
at March 18, 2015 20:39 by burnandbass


Updated Code
function custom_posttype_in_home_loop($query)
{
    if (is_home() && $query->is_main_query() || is_feed())
        $query->set('post_type', array('post', 'demo'));
    return $query;
}

add_filter('pre_get_posts', 'custom_posttype_in_home_loop');

Revision: 68920
at March 18, 2015 20:36 by burnandbass


Initial Code
function custom_posttype_in_home_loop($query)
{
    if (is_home() && $query->is_main_query())
        $query->set('post_type', array('post', 'demo'));
    return $query;
}

add_filter('pre_get_posts', 'custom_posttype_in_home_loop');

Initial URL


Initial Description
Add 'demo" posttype in main loop and also in the RSS feed

Initial Title
Custom posttype in homepage loop

Initial Tags


Initial Language
PHP