/ Published in: PHP

get custom fields value in wordpress theme
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
To be used only inside WordPress’s Loop <?php echo get_post_meta($post->ID, 'custom_field_name', true); ?> It displays the value of the custom field. Replace “custom_field_name†with the chosen name of your custom field. To display the value outside the loop use <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'custom_field_name', true); ?>
URL: http://codesnippets.info/wordpress/get-custom-fields-value/
Comments
