WordPress.org

Support

Support » How-To and Troubleshooting » Default featured image and for categories?

Default featured image and for categories?

  • Is there a way so have default image for the featured image?

    I already have the featured image/thumbnails showing on blog posts in my theme, but I want the ability to set a default image for the featured image.

    Sometimes I don’t always set a featured image so it’d be great if one could automatically be displayed if I didn’t set one.

    Is it also possible to set different default images for certain categories?

    (I have tried a few plugins that haven’t seemed to work)

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have researched more and I added `<?php
    //This must be in one loop

    if(has_post_thumbnail()) {
    the_post_thumbnail();
    } else {
    echo ‘<img src=”‘.get_bloginfo(“template_url”).’/images/sr100.png” />’;
    }
    ?>
    `
    into my fucntions.php file but it’s not working

    Parse error: syntax error, unexpected ‘<‘

    Anyone?

    I’m afraid It’s a standard way but just it work.
    insert codes like below

    if (has_post_thumbnail()) {
    the_post_thumbnail(); }
    <a href="<?php the_permalink(); ?>"><img src="your image path"></a>

    I think Codex would be fixed up anyway

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Default featured image and for categories?’ is closed to new replies.