Support » Fixing WordPress » Custom fields

  • designnz

    (@designnz)


    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

Viewing 1 replies (of 1 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    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 } ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Custom fields’ is closed to new replies.