Display both standard posts in a specific category along with a custom post type in a single loop?

I’m building a content slider that needs to show posts from a custom post type called “Features,” and also show standard blog posts that are assigned to a “Featured” category. I’d like to do this within a single loop. Can anyone help me put together the query that could handle this?

Related posts

Leave a Reply

2 comments

  1. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    query_posts( array(
            'post_type' => array(
                        'post',
                        'features',
    
                    ),
    'category_name' => 'Featured',
                    'paged' => $paged )
    
                );
    
    // have some posts?
    if (have_posts()) :
        while (have_posts()) : the_post();
    
            // the loop
    
        endwhile;
    endif;
    ?>
    
  2. Fix paging issues:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    

    Query to add in custom post types:

    query_posts( array(
            'post_type' => array(
                        'post',
                        'custom_post_type_name'
                    ),
                    'paged' => $paged ) 
                );
    

    Start the main loop

    if (have_posts()) :
        while (have_posts()) : the_post();
    
                //Post content
    
        endwhile;
    endif;
    ?>