WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Need help with if or elseif-statement

[Resolved] Need help with if or elseif-statement

  • Hey all,

    I am currently editing a theme (Volt) that uses the TimThumb script. I am trying to make the script 1) display an attached thumbnail if there is one 2) if not, display a thumbnail specific to that category, and 3) if no image is found for the category, display a default image.

    Here is part of the current script:

    if ( has_post_thumbnail()) {
    $img_src = wp_get_attachment_image_src( get_post_thumbnail_id($GLOBALS['post']->ID), '');
    $thumbnail = $img_src[0];
    }
    else { $thumbnail = '';
    $default_thumb = $bloginfo.'/images/post_thumb.jpg';
    $thumbnail = ( $thumbnail == '' ) ? $default_thumb : $thumbnail;
    }

    As you can see, 1) and 3) are taken care of in the default script. My issue is that I am a beginner in php and don’t know how/where to put the 2) statement.

    Please help!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Need help with if or elseif-statement’ is closed to new replies.