I want to hide the navigation menu on a particular page

admin2025-01-07  6

I want to hide the navigation menu on a particular page. I know how to find the page id, but I am clueless about how to find the rest of the stuff, it would be great if someone could look into my blog's css from the link - idkwhereto

Thanks.

I want to hide the navigation menu on a particular page. I know how to find the page id, but I am clueless about how to find the rest of the stuff, it would be great if someone could look into my blog's css from the link - idkwhereto.com

Thanks.

Share Improve this question asked Jul 14, 2018 at 8:23 Akash MalikAkash Malik 212 bronze badges 2
  • Does your theme use body_class() in header.php? – Krzysiek Dróżdż Commented Jul 14, 2018 at 9:38
  • I just checked, yes it does. – Akash Malik Commented Jul 14, 2018 at 9:50
Add a comment  | 

2 Answers 2

Reset to default 0
add_action("wp_footer","Stack_308520_hide_menu");

function Stack_308520_hide_menu(){
    if(is_page(889 /*your page id*/){
    ?>
   <style> nav.width-navigation {display:none}</style>

   <?php
    }
}

this is a pure css solution

If your theme uses body_classfunction in header.php, then you don't need to do anything in code...

Just add this code as Additional CSS in Customizer (Appearance -> Customize)

body.page-id-2 nav.width-navigation {display:none}
/* where 2 is the ID of your page */

But remember - it will only hide the navigation - it still will be in HTML code...

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736265231a1029.html

最新回复(0)