[Resolved] Default featured image

Home Forums Support [Resolved] Default featured image

Home Forums Support Default featured image

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #2043765
    guevara

    Hello,

    I would like to have a default image for all posts without a featured image. Please help.

    #2043774
    David
    Staff
    Customer Support
    #2043784
    guevara

    tried it but it doesnt update hence my question.

    #2043801
    David
    Staff
    Customer Support
    #2043866
    guevara

    not working, Thanks

    #2043943
    Ying
    Staff
    Customer Support

    Hi there,

    What was the exact code you used?

    And can you link us to your site?

    #2043979
    guevara

    add_filter( ‘post_thumbnail_html’, ‘tu_post_thumbnail_fallback’, 20, 5 );
    function tu_post_thumbnail_fallback( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
    if ( empty( $post_thumbnail_id ) ) {
    $html = ‘‘;
    }

    return $html;
    }

    #2043984
    guevara

    please find below

    #2044001
    Ying
    Staff
    Customer Support

    Since you are using block element – content template for the blog page, the easiest way would be edit the content template, using a container block with background image instead of using the dynamic image block.

    So the structure can be something like this:
    https://www.screencast.com/t/BYFen5qfLl

    Choose a background image for the container block, this image will be the fall back image for posts that don’t have featured image, activate the use fall back image option:
    https://www.screencast.com/t/wBabfzj9U3

    Let me know if this helps 🙂

    #2044062
    guevara

    Sorry I am bit confused – can you break the process down a bit so that I can understand it more. Thanks

    #2044074
    Ying
    Staff
    Customer Support

    Which part do you not understand?

    #2044085
    guevara

    I am not using an element for the blog page as such just a header block page hero. Where exactly am I expected to edit?

    #2044092
    Ying
    Staff
    Customer Support

    You are using a block element – content template for the blog:
    https://www.screencast.com/t/gTow9rS1E

    Can you go to appearance > elements, check if there’s a block element – content template?

    If you are not sure, can you enter the admin access in private info field so I can take screenshot for you?

    #2044098
    guevara

    Below

    #2044102
    Ying
    Staff
    Customer Support

    This is the element I was talking about:
    https://www.screencast.com/t/lJytcnBVe

    1. Remove the dynamic image block:
    https://www.screencast.com/t/9VSWCo6KwmAa

    2. Add a container block, so the structure becomes:

     Container 
       - Container (add background image to it)
       - Container
         - Headline
         - Headline
         - Dynamic content 
         - Buttons
             - Button
Viewing 15 posts - 1 through 15 (of 27 total)
  • You must be logged in to reply to this topic.