I'm trying to place a small code in my template
header.php file. I want to get a custom field value.
I'm trying to call custom fields from current page outside of loop, btw.
I have no problem doing this when I need to get custom field values from posts, but I can't seem to do this for pages.
Here is my code:
global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'teaser-text', true);
I'm not sure what I'm doing wrong. I tried changing
$wp_query->post->ID; to this
$wp_query->page->ID; to no success.
Any help is appreciated, thank you!