Home › Forums › Support › Remove the element from frontpage This topic has 7 replies, 2 voices, and was last updated 2 years, 11 months ago by Ying. Viewing 8 posts - 1 through 8 (of 8 total) Author Posts April 4, 2023 at 10:25 am #2596761 Carsten Hi there, how do I remove the header from the frontpage only? I have added this condition to the code from the documentation https://docs.generatepress.com/article/generate_header/ but it has no effect, and displays the header on other pages as well. add_action( 'after_setup_theme', 'tu_remove_header' ); function tu_remove_header() { if ( is_front_page() ) { remove_action( 'generate_header', 'generate_construct_header' ); } } Thanks April 4, 2023 at 10:39 am #2596787 YingStaff Customer Support Hi Carsten, You can use a layout element to remove the header without using code. https://docs.generatepress.com/article/layout-element-overview/ Please be noted, if the navigation as header option is enabled, then the code will not work, as there’s no header but only navigation on your site. April 4, 2023 at 10:55 am #2596813 Carsten Hi Ying, I really want to add the function to my functions.php instead, so any idea why the code should not work here? Thanks April 4, 2023 at 12:01 pm #2596919 YingStaff Customer Support Can you link me to your site? April 4, 2023 at 12:24 pm #2596957 Carsten Sure April 4, 2023 at 12:41 pm #2596978 YingStaff Customer Support Try this code instead: add_action( 'wp', 'tu_remove_header' ); function tu_remove_header() { if ( is_front_page() ) { remove_action( 'generate_header', 'generate_construct_header' ); } } April 4, 2023 at 1:13 pm #2597014 Carsten Hi Ying Thank you, it is working perfectly. Just curius on, why the other code snippet is not working when the if is_front_page statement is added? April 4, 2023 at 3:40 pm #2597113 YingStaff Customer Support When after_setup_theme doesn’t work, try wp 🙂 Author Posts Viewing 8 posts - 1 through 8 (of 8 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In