Show 1 recent post from 2 custom post types
-
I am trying to show the most recent post from 2 different post types. I can get it to show the most recent post from one of them bot not look at both and get the most recent of the 2. Below is the code that I am using any help would be much appreciated.
<?php $recent = new WP_Query('outtakes&outtake_category=outdoor-recreation', 'adirondack_almanac&adirondack_almanac_category=outdoor-recreation'); ?> <?php $count = 0; ?> <?php while( $recent->have_posts() ) : $recent->the_post(); ?> <?php $count++; ?> <?php if ($count < 2) : ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php if ( has_post_thumbnail()): the_post_thumbnail( 'feed-fixed' ); endif; ?></a> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3> <?php echo wp_trim_words( get_the_excerpt(), 20 ); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">>>More</a> <?php else : ?> <?php endif; ?> <?php endwhile; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Show 1 recent post from 2 custom post types’ is closed to new replies.