I'm working on a parent page that basically consists of nothing more than a big list of its child pages. The title of each child page is given, along with a thumbnail and some basic excerpt details via custom fields and get_post_meta. So far so good. Where I'm falling down is what happens when a custom field is requested and it's not there, and how to then replace that missing data with default data. I can manage it no probs with the thumbnail, but not for the excerpt. The page isn't live I'm afraid - but here's the code I'm using:
$excerptPath = get_post_meta($post->ID, \"excerpt\", true); if($excerptpath ==\"\") { $excerptpath = \"We haven't included any text here yet, but we hope to have done so shortly!\"; }
If the 'excerpt' custom field is not present, however, the dummy text doesn't show. This exact syntax works fine for the thumbnail custom field (replacing it with a fallback img path). Why doesn't it work in this case?
$excerptPath = get_post_meta($post->ID, \"excerpt\", true); if($excerptpath) { $excerptpath = \"We haven't included any text here yet, but we hope to have done so shortly!\"; }
<?php $excerptPath = get_post_meta($post->ID, \"excerpt\", true); if($excerptpath) { $excerptpath = \"We haven't included any text here yet, but we hope to have done so shortly!\"; } ?>
I'm working on a parent page that basically consists of nothing more than a big list of its child pages. The title of each child page is given, along with a thumbnail and some basic excerpt details via custom fields and get_post_meta. So far so good. Where I'm falling down is what happens when a custom field is requested and it's not there, and how to then replace that missing data with default data. I can manage it no probs with the thumbnail, but not for the excerpt. The page isn't live I'm afraid - but here's the code I'm using:
If the 'excerpt' custom field is not present, however, the dummy text doesn't show. This exact syntax works fine for the thumbnail custom field (replacing it with a fallback img path). Why doesn't it work in this case?
Thanks in advance! Any help appreciated.
I figure that the code is correct, ('coz that's basically what's in the Codex) but that I'm putting it in the wrong place.
Here's the whole page (not too big!):
Again, any help greatly appreciated! :D