Forums

Custom field value existence check (3 posts)

  1. stevesydney
    Member
    Posted 1 year ago #

    Hi there,

    I need to know if it's possible, and if so, how, to do:

    If there is a custom field named 'name' that has the value 'value' then do echo this 'string' else, do nothing.

    Any ideas?

    Cheers!
    Steve

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    <?php $value = get_post_meta($post->ID,'name',true); if( $value ) { echo $value; } ?>

  3. stevesydney
    Member
    Posted 1 year ago #

    Legend. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic