• Hello!

    I would like to have a default image attached to posts automatically, if no specific image is selected instead.

    I seem to recall finding a plug-in that fit this functionality, which also could associate images with certain categories. Unfortunately, I can’t seem to find it now.

    Can someone suggest code or a relevant plug-in to achieve this?

    Thank you!

    K

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php if( has_post_thumbnail() ) : the_post_thumbnail();
    else :?> <img src="<?php bloginfo('stylesheet_directory'); ?>/images/default.jpg" width="xx" height="yy" alt="" />
    <?php endif;?>
    Thread Starter kondef

    (@kondef)

    Hey Esmi,

    Thanks for your reply. When I add that code to my index page, I get an error message stating that the function is undefined. Any thoughts?

    Fatal error: Call to undefined function: has_post_thumbnail() in /home/content/k/o/n/kontainer/html/SALMELAND/blog/wp-content/themes/MyTheme/index.php on line 12

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘What's the best way to add a default image to posts?’ is closed to new replies.