• Resolved emma_08

    (@emma_08)


    Hi,
    I created a custom-post-type using the Pods plugin.
    One of the fields is a “website” field.
    In single-portfolio.php, I have the following code in order to display the website field info.

    `<p>
    <?php $website = get_post_meta($post->ID, ‘website’, true);?> Website: <a target=”_blank” href=”<?php echo $website; ?>”><?php echo preg_replace(‘|https?://|’, ”, $website ); ?></a><?php $site = preg_replace(‘{/$}’, ”, $website); ?>
    </p>`

    However, I would like this field / or word “Website:” to appear in the browser ONLY if the field was completed in the wp-admin. Meaning, if this particular project does not have any website info associated with it, the text “Website” should not appear at all on the page.

    I would appreciate if anyone would be able to give any insight on how to achieve this.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom-post-type field only display if completed’ is closed to new replies.