Conditional Custom Field
-
Hi,
I want to add a conditional custom field to my posts (by adding to functions.php). I need to basically add a custom field to all posts automatically, if one hasn’t already been added.I found this code:
<?php $songs = get_post_meta($post->ID, 'songs', true); /checking if anything exists for the key Songs if ($songs) { ?> Listening to: <?php echo $songs; ?> <?php } //if there is nothing for songs then display else { ?> Listening to: Nothing (Grooveshark is under maintenance) <?php } ?>
I need to modify that however to add an “Image” custom field, how would I do that? Thanks.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Conditional Custom Field’ is closed to new replies.