Using meta data outside of the main loop
-
I must be missing something really obvious here, but I just can’t seem to get it.
I’m trying to add some meta data (entered via a custom field named ‘offers’) to the header of my page.
I suspect that the code I need is:
$offers = get_post_meta($post->ID, 'offers', TRUE);
The problem that I have with this is I need to be inside ‘the loop’ to use $post->ID don’t I? My header appears before the main loop begins, so I have a bit of a problem.
I’ve seen that maybe multiple loops is the way to go, is that correct?
Regards
Rich
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using meta data outside of the main loop’ is closed to new replies.