Consolidating Queries
-
I have a custom theme that uses a custom post type and multiple custom meta fields.
Everything is working great but I would like to see if there is a better way to consolidate the queries. I just do not want to be repeating things or doing things that are unnecessary. I have research for weeks and I think I am just confusing myself even more.Here is the code the I am using for on the main page to display the most recent post:
<?php $args = array('post_type' => array( 'post', 'obituaries' )); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="obits_list"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'thumbnailxs'); ?></a> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <p><?php echo get_post_meta( get_the_ID(), 'bldob_bdate', true ); ?> ~ <?php echo get_post_meta( get_the_ID(), 'bldob_ddate', true ); ?></p> <p>Services will be held: <?php echo get_post_meta( get_the_ID(), 'blser_date', true ); ?></p> </div> </div><!-- #post-<?php the_ID(); ?> --> <?php endwhile; ?>Any suggestions are greatly appreciated.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Consolidating Queries’ is closed to new replies.