WordPress.org

Ready to get started?Download WordPress

Forums

Custom fields (2 posts)

  1. designnz
    Member
    Posted 1 year 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. alchymyth
    The Sweeper & Moderator
    Posted 1 year 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