肮脏的解决方案:
$custom_image = types_render_field("photo", array("alt"=>"Product image","width"=>"300","height"=>"200","proportional"=>"true");
if($custom_image) {
// this page has a custom photo. Print it.
print $custom_image;
} else {
// this page don\'t have a photo, therefore we output the photo of the default page
$id = 1; // the id of the default page
$post = get_post($id);
setup_postdata($post);
print types_render_field("photo", array("alt"=>"Product image","width"=>"300","height"=>"200","proportional"=>"true");
wp_reset_postdata();
}
或者,如果你真的想要到处都是相同的照片,那么只需使用else子句中的内容