[Resolved] Remove Post Image from Code

Home Forums Support [Resolved] Remove Post Image from Code

Home Forums Support Remove Post Image from Code

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #137045
    Alexander

    Hi Tom,

    i have set Post Images on my Sites and Posts, but i do not want to show them in the Page Header.

    Is there ar Filter to remove it in the Code?

    Alex

    #137119
    Tom
    Lead Developer
    Lead Developer

    Where are you wanting them to show up? Only with your blog excerpts?

    #137144
    Alexander

    possibly, but not in the page header.

    #137268
    bdbrown

    Hi Alex. This function should remove the page header:

    add_action( 'wp','generate_remove_page_header' );
    function generate_remove_page_header() {
      if ( is_page() )
        remove_action('generate_after_header','generate_page_header', 10);
    }
    

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    #137277
    Alexander

    Thanks Tom, but it works only on Pages, not on Posts.

    #137282
    Tom
    Lead Developer
    Lead Developer

    You could do this to target everything:

    add_action( 'wp','generate_remove_page_header' );
    function generate_remove_page_header() {
        remove_action('generate_after_header','generate_page_header', 10);
    }
    #137292
    Alexander

    Unfortunately does not work for me, furthermore only with Pages, not with Post-Pages.

    #137299
    bdbrown

    i have set Post Images

    Is this referring to the Featured Image? And can you post a link to your site? That would help in trying to troubleshoot the issue.

    #137300
    Tom
    Lead Developer
    Lead Developer

    Try this to remove both (you could also just not set the featured/post image).

    add_action( 'wp','generate_remove_page_header' );
    function generate_remove_page_header() {
        remove_action('generate_after_header','generate_page_header', 10);
        remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
    }
    #137307
    bdbrown

    If you can’t get the function to go you might try this css:

    .page-header-image, .page-header-image-single {
        display: none;
    }
    
    #137311
    Alexander

    Sorry, no succes 🙁

    >>Try this to remove both (you could also just not set the featured/post image).
    Yes i know, but i want to have it for a overview Page (with Posts).

    >>If you can’t get the function to go you might try this css:
    -> “Remove Post Image from Code” not only from Screen 🙂

    #137317
    bdbrown

    The functions should all work. Can you post a link to your site?

    #137318
    Alexander

    Sorry, not at the moment, it is under construction and .htaccess protected.

    #137327
    bdbrown

    If you have the Page Header Add-on installed, deactivate it. Then try this function:

    add_action( 'wp','generate_remove_page_header' );
    function generate_remove_page_header() {
        remove_action('generate_after_header','generate_featured_page_header', 10);
        remove_action('generate_before_content','generate_featured_page_header_inside_single', 10);
    }
    
    #137338
    Alexander

    Hi bdbrown,

    thanks, this works now!

    Alex

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