• Resolved jrcollins

    (@jrcollins)


    I’m using the following PHP conditional statement to display featured images:

    <?php if(is_category('blog-posts')) {
    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-thumb' ); }
    else {
    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); }
    ?>

    The code works as is, but don’t I need to include <?php endif; ?>?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to format PHP IF…ELSE conditional statement?’ is closed to new replies.