How you call these on a page?
Exactly the same way that you call them in a post.
do you HAVE to call them inside the loop?
No – as long as you can pass a post or page id to the function, you should be able to use it anywhere.
If you call the custom field routine within the loop using the standard structure of get_post_meta($post->ID, 'nameoffield', true) then it will be addressing the post’s ID from the loop.
The way to use the page’s ID is to first save the ID in a variable before the loop begins (eg, at the top of your php add <?php $thispage = get_the_ID(); ?> ) and then within the loop you can get the custom field with get_post_meta($thispage, 'nameoffield', true)
Another way of doing it, of course, would be to save all of the page’s custom fields into variables before the loop and then you won’t have to use get_post_meta within the loop itself, thus avoiding confusion if you’re also pulling in post custom fields too.
Hope that helps
Peter
Thanks Peter, that looks like a nice workaround
I’ve tried the example Peter mentioned, i can get the custom fields of the page but only using <?php the_meta();?> , i’ve saved the page id before the loop and then inserted the get_post_meta($thispage, 'nameoffield', true) code, but it’s not working, maybe i need something else to make it work? any tips?
it’s working now =) , thanks just had to add :
<?php echo get_post_meta($thispage, 'nameoffield', true) ?>