Ready to get started?Download WordPress


Add a default featured image on post (4 posts)

  1. tymmy456
    Posted 1 year ago #

    Is there any way I can set a default featured image if it's not set manually? I'm using WP 3.5.1 and Atahualpa 3.7.7 I'm showing only the excerpts of the post and if it's set a feature image it will show, I will want to add a default featured image to every post or use the first picture on the post. Thank you for the help, help me and others with their problems :)

  2. Just downloaded the theme and poked around. If you look at the bfa_post_parts.php which is in the functions folder, you'll find on line #149:

    if(has_post_thumbnail()): ?>
                    <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
    				<?php endif;

    You could change that to have an else as well.

    if( has_post_thumbnail() ) {
     	<a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
    	} else {?>
    <a href="<?php the_permalink() ?>"> <img src="<?php bloginfo( 'template_directory' );?>/images/default.gif" alt=""></a>
     <?php } ?>

    I would try that and see what happens.

  3. tymmy456
    Posted 1 year ago #

    I tried that but I pu the code like this:

    if (function_exists('the_post_thumbnail') AND !function_exists('tfe_get_image')) {
    		     if(has_post_thumbnail()): ?>
                    <a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
    				<?php endif; ?>
    			<p><a href="<?php the_permalink() ?>"> <img src="HERE THE LINK OF THE PIC" alt=""></a></p>
    	echo $after;

    But it puts the picture even if it already has a featured image. Also it shows on the top of the excerpt no of the left side as it would look with the featured image set manually.
    1.How it looks if I put it manually:
    2. How it looks when I added the code:
    3. How it looks with setting the featured image manually.
    Thank you for the help and the code, I really appreciate that :).

  4. juggledad
    Posted 1 year ago #

    ever think about trying a plugin like 'Auto Post Thumbnail'?

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic