WordPress.org

Forums

Custom fields (2 posts)

  1. designnz
    Member
    Posted 2 years ago #

    I have a custom field called "condition" with two options "new" and "used",

    Now i want to be able to call an if statement where when either of the two above options are selected an echoed style is outputted?

    Anyone have any ideas?

    Thanks in advanced

  2. Michael
    Forum Moderator
    Posted 2 years ago #

    example:

    <?php if( get_post_meta( $post->ID, 'condition', true ) == 'new' ) { ?>
    echo your style for new
    <?php } elseif( get_post_meta( $post->ID, 'condition', true ) == 'used' ) { ?>
    echo your style for used
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic