Display multiple custom fields in a single line only if values are present
-
Hi all, I want to display more than one custom field values together in a single line inside single.php and only if it’s present.
For example:
$50.00 | LinkI found the following code in a forum but it’s displaying in two lines in the post. I need it in a single line:
<?php $value = get_post_meta($post->ID, 'price', true); if($value) : ?> <?php echo get_post_meta($post->ID, 'price', true); ?><?php endif; ?> | <?php $value = get_post_meta($post->ID, 'link', true); if($value) : ?><a href="<?php echo get_post_meta($post->ID, 'link', true); ?>" target="_blank">Link</a><?php endif; ?>
Please help!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display multiple custom fields in a single line only if values are present’ is closed to new replies.