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?

1 Answer 1


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.

  • just put it anywhere in the theme file i want to use.. or put in into exact location Commented Jan 28, 2011 at 2:55
  • 1
    @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
    Commented Jan 18, 2012 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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