Home Forums Fusion Default Fallback Image for WordPress Post Thumbnails

This topic contains 2 replies, has 2 voices, and was last updated by  Animatetrunks 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47982

    Animatetrunks
    Participant

    I want to add a Default Fallback Image for WordPress Post Thumbnails

    I have search on other forum and I find this, but I don’t find where I can add those lines of code:

    <?php if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    } else { ?>
    /images/default-image.jpg” alt=”<?php the_title(); ?>” />
    <?php } ?>`

    I have try to add it to single.php and archive.php but it didn’t work.
    Can anyone help me?

    Thank

    #47983

    Joshua
    Keymaster

    It depends on which single post style you’re using. Under fusion/template-parts/post/ you’ll see a number of files that are “single-{style-name}.php” where you’d need to add this. Same applies to the grid items in that same folder.

    But because there are so many places you’d need to change (and the above code will not work for background images), it would probably be a lot easier to use a plugin like this to set a fallback featured image – https://wordpress.org/plugins/default-featured-image/

    #47984

    Animatetrunks
    Participant

    I have try the plugin.
    It’s only work for new post, not older one that I have import (from my old website).

    Thanks for the help

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.