Posted By

BoNzO on 03/06/10


Tagged

wordpress code


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

tomcat23
jchristenbury
maxvee8
laurentzziu


Display Custom Fields Outside The Loop in WordPress


 / Published in: PHP
 

URL: http://www.wpbeginner.com/wp-themes/how-to-display-custom-fields-outside-the-loop-in-wordpress/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed:+wpbeginner+(Wordpress+for+Beginners)

  1. <?php
  2. global $wp_query;
  3. $postid = $wp_query->post->ID;
  4. echo get_post_meta($postid, 'Your-Custom-Field', true);
  5. wp_reset_query();
  6. ?>

Report this snippet  

You need to login to post a comment.