Posted By

davebowker on 11/09/08


wordpress query field optional custom advanced

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


WordPress query posts of certain custom field values

 / Published in: PHP

  1. <?php $headerimage = get_posts('showposts=3&meta_key=headerimage'); foreach($headerimage as $post) : setup_postdata($post); ?>
  2. <div id="header-image"><a href="<?php the_permalink(); ?>" title="Latest experiment from the DesignLab"><img src="<?php echo get_post_meta($post->ID, "headerimage", true); ?>" alt="" border="0" /></a></div>
  3. <?php endforeach; ?>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: SmpleJohn on November 10, 2008

Haven't tried it, but looks good. Could be useful for Wordpress as a CMS.

Posted By: Jacky888 on August 2, 2018

showbox pro apk for android latest version

You need to login to post a comment.