filtering custom post types by category on home page

Community Forums Forums Design Tips and Tricks filtering custom post types by category on home page

This topic is: not resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Debs 1 year, 7 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31700

    Debs
    Participant
    Post count: 15

    any coding ninjas out there who can help me with this problem? i’m using genesis media project which creates the custom post type “video”. so far so good. this custom post types can also be assigned video categories (taxonomy “video-category”). i would like one of these video categories – “interviews” – only to appear in the home page loop. i can get ALL the video post types to appear using the code below, but would like to refine it even further.

    any ideas anyone? i’m stumped. thank you!

    /**ADD VIDEO POST TYPE TO MAIN TO HOME PAGE **/

    add_filter( 'pre_get_posts', 'my_get_posts' );

    function my_get_posts( $query ) {

    if ( ( is_home() && $query->is_main_query() ) )
    $query->set( 'post_type', array( 'post', 'video') );

    return $query;
    }

    #31704

    braddalton
    Participant
    Post count: 10245
    #31710

    Debs
    Participant
    Post count: 15

    thanks brad…unfortunately none of these methods seem to work for custom post types…only ordinary posts…it’s driving me nuts!!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.