• Hello,

    I’m using The Morning After theme by Woothemes, but as its a free theme they don’t offer any help.
    When posting you’re asked to choose an image to be displayed on the first page; however, if none is chosen then nothing is shown.
    What I would like is for a default image to be chosen if there’s no image uploaded/choosen when the user posts.

    The code for retrieving the image looks like this:

    <div id="latest_post_image">
    					<?php woo_image('width=470&height=210'); ?>
    					</div>

    So, how can I get it to get “default.jpg” if the woo_image is empty. Would be very thankful for any help.

Viewing 1 replies (of 1 total)
  • Looking through their code, it appears that they let you define a default thumbnail somewhere in the theme options page.

    Regardless, you can try adding something like this:

    <?php
    $woo_image = woo_image('return=1&width=470&height=210');
    if( !is_empty($woo_image) {
      echo $woo_image;
    }
    else {
      echo get_bloginfo('template_directory').'/images/default-thumbnal.jpg';
    }
    ?>

    where ‘/images/default-thumbnal.jpg’ is the path within your theme to the default image.

Viewing 1 replies (of 1 total)

The topic ‘Add default image PHP – TMA theme’ is closed to new replies.