[wp-hackers] php in post: wp_query to get pages with specific meta values

mailapera mailapera at gmail.com
Thu Apr 22 01:13:19 UTC 2010


I am using this function in my post editor in congiunction with the
Exec-PHP plugin

$my_query = new WP_Query();
while ($my_query->have_posts()): $my_query->the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title();
?>"><?php the_title(); ?></a>
<?php endwhile; ?>

Basically I am trying to get all the pages that have one or both the
specific meta (either the key, the value, or both) so I can call them
in one specific page without having to resort to a new page template.
Using wp_list_pages is fine and dandy but it only outputs a list. I
would like to have an excerpt with each link, be able to customize all
results, therefore the need for a more elaborate code.

I am on WP 2.6.5


More information about the wp-hackers mailing list