[Support request] Remove Featured Image On Certain Posts – Dispatch Demo

Home Forums Support [Support request] Remove Featured Image On Certain Posts – Dispatch Demo

Home Forums Support Remove Featured Image On Certain Posts – Dispatch Demo

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1989538
    Blair

    I have read through many of the topics on this and still can’t get the settings correct.

    I want to be able to show the Dispatch featured image on certain posts, but from the individual page settings, not the global element.

    I am rebuilding my site and imported 100+ posts, but my featured image is not sized correctly. I want to hide the featured image on those and going forward use the correct size image.

    Also, some posts don’t need a featured image on page. I know I can disable them in the element settings, but that is global.

    Is there a way to do it page by page depending on the content I have?

    #1990003
    David
    Staff
    Customer Support

    Hi there,

    whats the ultimate goal here? Is it to remove the Hero Element on the site ? But one at a time and display the default featured image instead ?

    #1990010
    Blair

    I want to use the hero image that Dispatch has with out the meta data ( author / date / category), just title on all some new posts going forward. Some articles a hero image doesn’t make sense and I want to have fast LCP in google page speeds.

    I will be going back and adding in new featured images that are sized correctly for old posts.

    Right now the on page meta box inside the editor, when I turn off featured image, it doesn’t hide the Dispatch Hero Image. If I disable the hero image global, I can hide / unhide the standard featured image.

    THANK YOU!!!!

    #1990064
    David
    Staff
    Customer Support

    Try adding this PHP Snippet:

    add_filter( 'generate_element_display', function( $display, $element_id ) {
        if ( 123 === $element_id ) { // Only target specific Element
            if ( has_post_thumbnail() && get_post_meta( get_the_ID(), '_generate-disable-post-image', true ) === 'true' ) {
                $display = false;
            }
        }
        return $display;
    }, 10, 2 );

    In this part of the code: 123 === $element_id you need to change the 123 to the ID of the Element. You can find the ID by editing the Element, and checking the URL in the browser.

    This will disable that Element if the post has a featured image and the Disable Featured Image option is selected.

    #1990443
    Blair

    Thanks, will do

    #1990810
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.