- This topic has 16 replies, 6 voices, and was last updated 5 years, 1 month ago by
Leo.
-
AuthorPosts
-
June 11, 2020 at 8:20 am #1323849
Fabien
Hi,
Is there a php function to remove the entry-header within a post ?
Thanks !
June 11, 2020 at 8:43 am #1323870Leo
StaffCustomer SupportHi there,
So you want to remove the post title and entry meta?
Would this for both the posts page and single post?
June 12, 2020 at 1:07 am #1324647Fabien
Yes, I want to remove the div.entry-header (and it’s content : title, featured image, meta) using a PHP function. I will target specific post type.
Thanks
June 12, 2020 at 7:07 am #1324986David
StaffCustomer SupportHi there,
there isn’t a hook for removing the entry-header container.
To do that you would need to create a custom template of the content-single and remove that HTML element:https://github.com/tomusborne/generatepress/blob/master/content-single.php
June 12, 2020 at 8:12 am #1325216Fabien
Thanks David ! I think having function would be nice 😉 Could that be added in the roadmap ?
June 12, 2020 at 8:17 am #1325226David
StaffCustomer SupportAs the entry-header is a core element of the single post – removing it feels like a custom template is required. But i will mention it to Tom 🙂
June 12, 2020 at 8:58 am #1325283Fabien
Yes it would make sense instead of having empty html tags : https://share.getcloudapp.com/GGuoAKzo
December 21, 2020 at 1:24 pm #1589866Fabien
December 22, 2020 at 11:02 am #1591060Tom
Lead DeveloperLead DeveloperHi there,
Yes, this filter was added in 3.0: https://github.com/tomusborne/generatepress/blob/3.0.2/inc/theme-functions.php#L148
So you can do this:
add_filter( 'generate_show_entry_header', function( $show ) { if ( $my_condition ) { $show = false; } return $show; } );December 23, 2020 at 12:39 am #1591634Fabien
Awesome Tom !
December 23, 2020 at 11:13 am #1592397Tom
Lead DeveloperLead DeveloperGlad I could help 🙂
February 28, 2021 at 3:19 am #1675792Edmund
Hi, I am looking to remove the entry header from the published post.
I am new to GeneratePress, so apologies for my ignorance.
I see that a “filter” shown above was added in 3.0 – but what do you need to do to use it.
I tried pasting the “so you can do this” code in my child theme Functions.php file, but that did not work, so I tried pasting it in the custom CSS but again that did not work.
Please advise.
ThanksFebruary 28, 2021 at 10:49 am #1676334Ying
StaffCustomer SupportHi Edmund,
This is how you add PHP 🙂
Adding PHP: https://docs.generatepress.com/article/adding-php/February 28, 2021 at 12:47 pm #1676470Edmund
Hi Ying,
Thank you for your reply. I did try pasting into Functions.php of my child theme, but it did not work.
However I have since found the solution on each “Page” in WordPress, in the toolbar on the right, has at the bottom, “disable elements” one of which is the content Title.
So that worked for me.February 28, 2021 at 1:00 pm #1676484Leo
StaffCustomer SupportYou can try creating a layout element if you need to do that globally:
https://docs.generatepress.com/article/layout-element-overview/#disable-element -
AuthorPosts
- You must be logged in to reply to this topic.