What I use in the regular page.php which works fine.
<?php $page_image = get_post_custom_values('page_image'); ?>
<?php echo $page_image[0]; ?>
But when used in a custom page template, the kind you specify with
/*
Template Name: HOME
*/
The custom field does not show up. It is specified in the page that uses the custom page template.
Please paste all the code from that 'Home' template file into a pastebin such as wordpress.pastebin.ca, and report the link back here. Maybe someone can spot your problem. Thanks.
Try
<?php $page_image = get_post_custom_values('page_image',$posts[0]->ID); ?>
senscore
Member
Posted 2 years ago #
I have the same problem. In single (default) page template this works
<?php $page_image = get_post_custom_values('page_image',$posts[0]->ID); ?>
<?php echo $page_image[0]; ?>
But it does not work in custom page templates. Can not understand why...
Any solutions?
Works fine for me using the WordPress Default theme with custom page template and the page.php that comes with WordPress. This right after get_header;
<?php echo 'post id ' . $posts[0]->ID; ?>