Archived topic
Remove Post Image from Code
23 replies · Started by Alexander on September 15, 2015
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
Where are you wanting them to show up? Only with your blog excerpts?
possibly, but not in the page header.
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/
Thanks Tom, but it works only on Pages, not on Posts.
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);
}
Unfortunately does not work for me, furthermore only with Pages, not with Post-Pages.
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.
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);
}
If you can't get the function to go you might try this css:
.page-header-image, .page-header-image-single {
display: none;
}
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 :)
The functions should all work. Can you post a link to your site?
Sorry, not at the moment, it is under construction and .htaccess protected.
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);
}
Hi bdbrown,
thanks, this works now!
Alex