Wordpress Technology

Wordpress Tips, Tutorials, Hacks

To print out the post with specified field/value we have to find the main loop to display the posts and add query_posts() function, as showed below.


<?php query_posts('meta_key=review_type&meta_value=music'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

As a result, we have list of posts with custom field ‘output_type’ and value ‘out’. You can use any of field names and values to display posts.

meta_key – name of custom field
meta_value – it’s value

The posts may be displayed by any of these parameters, excluding unnecessary one.

The code above can be used to display list of specified posts called featured-posts.

Both comments and pings are currently closed.

© 2009 | Made by Vancouver Web Design | Internet Marketing