• Resolved Niki

    (@nsebastino)


    I am trying to show blog posts in category 5 AND custom post type tribe_events in one loop in my homepage template. I have this working fine in two loops but I must have some syntax issue with my query because the below displays nothing

    <?php query_posts('post_type=tribe_events&cat=5&showposts=3'); ?>
            <?php while (have_posts()) : the_post(); ?>
                    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                    <p><?php echo get_the_excerpt(); ?></p>
            <?php endwhile;?>

    Thank you!

Viewing 1 replies (of 1 total)
  • Thread Starter Niki

    (@nsebastino)

    I found the solution:

    <?php $args = array( 'post_type' => array( 'post', 'tribe_events' )); ?>
      <?php $custom_query = new WP_Query( $args ); ?>
      <?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Need to display blog posts and custom post type using one loop’ is closed to new replies.