• Resolved Shafar

    (@shafar)


    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 | Link

    I 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)
  • Thread Starter Shafar

    (@shafar)

    Oops! Please ignore. It was a problem with the theme!

    Thanks if you are seeing this!

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.