Archived topic
Can't hide nav menu with option_generate_blog_settings filter
5 replies · Started by Jim on October 1, 2020
Kind of carrying over this question from the wordpress plugin support site, now that I've purchased GP Premium.
I'm trying to not have the primary nav menu on single posts of a custom post type (ncpage). I activated the Blog module, and understand that should activate the filter I'm trying to use. Here's what I have in functions php and is not working:
add_filter( 'option_generate_blog_settings', 'fp_no_nav' );
function fp_no_nav( $options ) {
if ( is_singular( 'ncpage' ) ) {
$options[‘single_post_navigation’] = false;
}
return $options;
}
Any thoughts?
Hi there,
You can actually use a layout element for that:
https://docs.generatepress.com/article/layout-element-overview/#disable-element
The CPT should be listed under the display rules.
Let me know if this helps :)
Thanks. Finally got it to work. Being new to GP Premium, it would be helpful if, in those articles, it would say which modules need to be activated to use it. In this case, it seems to be both Elements and Disable Elements. Presumably those modules need to be kept activated for it to continue to work?
You should only need to keep the Elements module activated.
The disable element module is for the metabox options:
https://docs.generatepress.com/article/disable-elements-overview/
OK, I was confused I'm sure. Maybe I activated Disable Elements for a different reason. Thanks for your help.
No problem :)