• How can do elseif “color2” condition in this code?

    <?php if(get_post_meta($post->ID, ‘color’, single)!=””) { ?>
    <h5><?php the_title(); ?></h5>
    <?php } else { ?>
    <h4><?php the_title(); ?></h4>
    <?php } ?>

    —color2 is the second custom field key.—-

Viewing 1 replies (of 1 total)
  • Thread Starter gioska

    (@gioska)

    resolved to my self ….the code below.

    <?php if(get_post_meta($post->ID, 'color', single)!="") { ?>
    <h5><?php the_title(); ?></h5>
    <?php } elseif (get_post_meta($post->ID, 'color2', single)!="") { ?>
    <h6><?php the_title(); ?></h6>
    <?php } else { ?>
    <h4><?php the_title(); ?></h4>
    <?php } ?>
Viewing 1 replies (of 1 total)

The topic ‘Else if here’ is closed to new replies.