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

I am still new to Wordpress and I want to insert a featured content gallery into a Wordpress page. I tried to do it myself, but it wanted me to use custom fields.

Where can I add custom fields, is there any coding required? or do I just enter the value into custom fields text box? I want to add and then use custom fields for images in my featured content gallery, can you please help me?

share|improve this question

Edit: Came back on this post much later but I am updating this with more correct information.

The following code will allow you to display the value of a custom field anywhere in your theme or plugin, as long as you are getting the correct post ID to pass to it. You would need to put global $post; inside your function in order to get the post ID from the global $post variable. If you have other means of getting the ID (such as get_the_ID() function), you can just use that in place of $post->ID.

    echo get_post_meta(

Old notes:

<?php echo get_post_meta($post->ID, 'CUSTOM_FIELD_NAME_HERE', true); ?>

This is the code you need. :)

Just put this in your theme file anywhere you want the custom value to be displayed inside of the loop, of course when you are posting, fill out the custom field text boxes accordingly.

share|improve this answer
just put it anywhere in the theme file i want to use.. or put in into exact location – Beginner Pogrammer Jan 28 '11 at 2:55
@BeginnerPogrammer If my answer was sufficient, can you mark it as best answer so that it doesn't haunt the website as "Unanswered"? Thanks. – Jared Jan 18 '12 at 14:12

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.