Display WordPress custom fields outside the loop
Below is an idea for showing WordPress custom fields outside the loop. In normal case custom fields are called within loop. You may try to expand your work with the possibilities of below code. Hope this will useful in some particular kind of work.
<?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'Your-Custom-Field', true); wp_reset_query(); ?> |
You may find more details of above code at WordPress