Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #662967

    Hi there,

    How can I change the default thumbnail image, which is displayed when no image is uploaded?

    Thank you in advance and all the best,

    Andreas

    #663011

    Hey andreasobermeier,

    Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)

    Do you want to remove it completely?

    Best regards,
    Andy

    #663020

    Hey Andi,

    sure, no problem.

    No, I don’t want to remove it, but replace it with a custom image.

    So the aim is the following: If a user creates a blog post and doesn’t upload a post image there should be a custom image displayed at the left side.

    Best,

    Andreas

    #663293

    Hi,

    just use WordPress’ default Featured Image option.

    Best regards,
    Andy

    #663299

    Hi Andy,

    for this I would have to add a plugin, right?

    Best regards,

    Andreas

    #663354

    Hi,

    no, just use WordPress’ default Features Image option: http://www.wpbeginner.com/beginners-guide/how-to-add-featured-image-or-post-thumbnails-in-wordpress/

    Best regards,
    Andy

    #666824

    Hi there once again,

    I couldn’ really solve that problem. I don’t want to use a plugin.

    The content in the link from you describes how to use the thumbnail function of WordPress.

    But I want to achieve the following:
    When creating a new post and e.g. I forget to upload a thumbnail I want a default fallback thmbnail picture to be displayed (right now it’s a pen).

    I found this code, but don’t know where to place it, however.

    <?php if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/default-thumb-img.png"
    alt="<?php the_title(); ?>" />
    <?php } ?>

    I hope you can help me with this one.

    Thank you for your support and best regards,

    Andreas

    #668404

    Hi,

    Please add this in the functions.php file instead:

    add_filter('avf_loop_index_blog_meta', 'avf_loop_index_blog_meta_mod', 10, 1);
    function avf_loop_index_blog_meta_mod($output) {
    	$link = get_permalink();
    	$fallback = strpos($output, 'iconfont');
    
    	if ($fallback <= 200) {
    	    $output = "<a href='{$link}' class='small-preview' title='Advanced Post'><img src='FALLBACK IMAGE URL HERE'/></a>";
    	}
    
    	return $output;
    }

    Adjust the placeholder image url.

    Best regards,
    Ismael

    #668611

    Hi Ismael,

    thank you it’s perfect. You can close this of course.

    Best wishes,
    Andreas

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Change default thumbnail image’ is closed to new replies.