Advertisement
FlyFX

Query in a query: Solved

Jan 18th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. // Query the database for all posts where $event_venue matches the venue of the current post
  2.    
  3.     <?php $the_query = new WP_Query( array( 'meta_key' => 'event_venue', 'meta_value' => $mix_venue ) );
  4.            
  5.    
  6.             while ( $the_query->have_posts() ) :
  7.             $the_query->the_post(); ?>
  8.             <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  9.             <?php endwhile;
  10.  
  11.             // Restore original Query & Post Data
  12.             wp_reset_query();
  13.             wp_reset_postdata();
  14.  
  15.            
  16.             ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement