Archived topic
Sticky Primary Navigation for specific pages?
21 replies · Started by shirtcreator24 on May 6, 2017
Ok. This CSS seems to work!!!
Anyway, could you provide me with the code to disable the sticky navigation? I will be able to try both routes and then I will decide. Thank you so much!
Ok. This CSS seems to work!!!
Anyway, Leo, could you provide me with the code to disable the sticky navigation? I will be able to try both routes and then I will decide. Thank you so much!
We can use this PHP snippet:
add_filter( 'option_generate_menu_plus_settings','lh_turn_off_sticky' );
function lh_turn_off_sticky( $options ) {
if ( is_page( 554 ) ) {
$options['sticky_menu'] = 'false';
}
return $options;
}
Adding PHP: https://docs.generatepress.com/article/adding-php/
More info here: https://docs.generatepress.com/article/option_generate_menu_plus_settings/
I have add your PHP snippet using Code Snippets plugin, as it is suggested in documentation, but it does not work... (I have remove the previous CSS to try it).
Sorry - edited the code above.
Yes. Now it works perfect! Thank you very much!
Only one more question: if I would like to do the same in other page, should I copy-paste changing the page-id or could I add more page-id to that function?
Thank you again. Your customer support service is amazing.
This should help: https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page
Glad we've been helpful :)