WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I pull a custom field with meta_key "proprty_feature" (and has a value) for all posts and display them on my frontpage? Would like to display the post name as a link above the value..

share|improve this question

Within your main post loop you would add something like,

get_post_meta($post->ID, 'property_feature', true);

A basic example of what your main loop might look like ( it depends on your theme) to include a title and your custom field.

//start the loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

//add post link and title
<a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

//add your custom meta value
<?php echo get_post_meta($post->ID, 'property_feature', true) ?>

//close loop
<?php endwhile; else: ?>
share|improve this answer
I apologize..I'm not sure if I'm following you..this will display a list of posts along with a corresponding custom field? So I can just put this in index.php? – Mike Mar 17 '11 at 3:06
Yes but I provided the example only to show you where it fits in. The loop example is extremely basic and very likely your theme has more styling and options. The important bit of code you need is the get_post_meta which as it sounds gets your post meta box based in name or key and returns the value. – Wyck Mar 17 '11 at 4:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.