- This topic has 3 replies, 2 voices, and was last updated 3 years, 11 months ago by
David.
-
AuthorPosts
-
April 20, 2022 at 11:50 am #2195178
Mike
Hi,
I am looking for a way to set customizer options in the GP child theme.
I know its possible as I have found these two articles:
https://generatepress.com/forums/topic/passing-customizer-settings-from-a-custom-child-theme-on-installation/
https://generatepress.com/forums/topic/how-can-i-create-a-child-theme-that-comprehends-customizer-settings/But I am just wondering if this is still the best way to go about this?
I have been playing around with the above methods and I am currently stuck on getting the
navigation_as_headerset astrue.I have tried setting the parameter using the
generate_option_defaultsfilter but having looked at a customizer export from another site it looks like this part ofgenerate_menu_plus_settingswhich I am guessing uses a separate filter?I’m wondering if there is a better method? Maybe do all my customizer edits, take an export, put that .json export file in the child theme and then a PHP snippet in the custom theme to import these settings from the file?
Or maybe some updated defaults filters?
Thanks in advance! Not an easy one!
Mike
April 21, 2022 at 2:15 am #2195671David
StaffCustomer SupportHi there,
so there are these additional filters:
https://docs.generatepress.com/article/option_generate_menu_plus_settings/
https://docs.generatepress.com/article/option_generate_blog_settings/
Not sure about automatically importing the settings.
April 21, 2022 at 12:48 pm #2196371Mike
Hi David,
Thanks for those links.
Had a quick look and I cant find a way to set the
navigation_as_headerparameter.Any ideas?
Have been trying the following code:
if ( !function_exists( 'theme_get_menuplus_defaults' ) ) : add_filter( 'option_generate_menu_plus_settings','theme_get_menuplus_defaults' ); function theme_get_menuplus_defaults() { $theme_menuplus_defaults = array( 'navigation_as_header' => true, 'slideout_menu' => 'both', 'slideout_menu_style' => 'overlay', 'mobile_menu_label' => '' ); return $theme_menuplus_defaults; } endif;Thanks!
Mike
April 21, 2022 at 11:31 pm #2196635David
StaffCustomer SupportOK there’s this defaults filter:
generate_menu_plus_option_defaults
You will find it ingp-premium/menu-plus/functions/generate-menu-plus.phpHere it is with all its defaults inc. the
navigation_as_headeradd_filter('generate_menu_plus_option_defaults', function($defaults){ return array( 'mobile_menu_label' => __( 'Menu', 'gp-premium' ), 'sticky_menu' => 'false', 'sticky_menu_effect' => 'fade', 'sticky_menu_logo' => '', // Deprecated since 1.8. 'sticky_menu_logo_position' => 'sticky-menu', // Deprecated since 1.8. 'mobile_header' => 'disable', 'mobile_menu_breakpoint' => '768', 'mobile_header_logo' => '', 'mobile_header_sticky' => 'disable', 'mobile_header_branding' => 'logo', 'slideout_menu' => 'false', 'off_canvas_desktop_toggle_label' => '', 'slideout_menu_side' => 'left', 'slideout_menu_style' => 'slide', 'slideout_close_button' => 'outside', 'auto_hide_sticky' => false, 'mobile_header_auto_hide_sticky' => false, 'sticky_navigation_logo' => '', 'navigation_as_header' => true, ); }); -
AuthorPosts
- You must be logged in to reply to this topic.