- This topic has 9 replies, 4 voices, and was last updated 2 years, 11 months ago by
David.
-
AuthorPosts
-
April 3, 2023 at 2:51 pm #2595369
David
Hi, I’d like to set some defaults in functions.php for styling of the off canvas panel. Could you please help with a filter for this? Thanks! David
April 3, 2023 at 6:48 pm #2595491Fernando Customer Support
Hi David,
Try adding these snippets:
add_filter( 'generate_color_option_defaults', 'new_generate_menu_plus_color_defaults' ); function new_generate_menu_plus_color_defaults( $defaults ) { $defaults['slideout_background_color'] = ''; $defaults['slideout_text_color'] = ''; $defaults['slideout_background_hover_color'] = ''; $defaults['slideout_text_hover_color'] = ''; $defaults['slideout_background_current_color'] = ''; $defaults['slideout_text_current_color'] = ''; $defaults['slideout_submenu_background_color'] = ''; $defaults['slideout_submenu_text_color'] = ''; $defaults['slideout_submenu_background_hover_color'] = ''; $defaults['slideout_submenu_text_hover_color'] = ''; $defaults['slideout_submenu_background_current_color'] = ''; $defaults['slideout_submenu_text_current_color'] = ''; return $defaults; } add_filter( 'generate_font_option_defaults', 'new_generate_menu_plus_typography_defaults' ); function new_generate_menu_plus_typography_defaults( $defaults ) { $defaults['slideout_font_weight'] = 'normal'; $defaults['slideout_font_transform'] = 'none'; $defaults['slideout_font_size'] = ''; $defaults['slideout_mobile_font_size'] = ''; return $defaults; }Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets
April 4, 2023 at 1:51 am #2595877David
Great, thank you Fernando. On the same note, can font-weight also be set this way for the normal primary navigation? Thanks! David
April 4, 2023 at 10:25 am #2596762Ying
StaffCustomer SupportYou can add one line of ‘navigation_font_weight’ to Fernando’s code, here’s the updated version:
function new_generate_menu_plus_typography_defaults( $defaults ) { $defaults['slideout_font_weight'] = 'normal'; $defaults['slideout_font_transform'] = 'none'; $defaults['slideout_font_size'] = ''; $defaults['slideout_mobile_font_size'] = ''; $defaults['navigation_font_weight'] => 'normal', return $defaults; }April 4, 2023 at 10:48 am #2596803David
Hi Fernando / Ying, I can;t seem to get any filter to work on ‘generate_font_option_defaults’ which is strange. My full function is:
add_filter( ‘generate_font_option_defaults’, ‘ffdv_ext_font_defaults’ );
function ffdv_ext_font_defaults( $ext_font_defaults ) {$ext_font_defaults[‘slideout_font_size’] = ’20’;
$ext_font_defaults[‘slideout_mobile_font_size’] = ’17’;
$ext_font_defaults[‘slideout_font_weight’] = ‘600’;
$ext_font_defaults[‘slideout_font_transform’] = ”;return $ext_font_defaults;
}
April 5, 2023 at 5:00 pm #2598767Fernando Customer Support
Hi David,
Can you make sure that there are no syntax errors or slanted quotation marks?
April 6, 2023 at 12:36 am #2599030David
Hi Fernando,
The syntax is all good, still no luck with this.
Thanks!
April 6, 2023 at 3:54 am #2599263David
StaffCustomer SupportHi there,
the
generate_font_option_defaultsis for the old Typography system. Where a default option existed for every typography setting.
This don’t work with the new dynamic typography system as there are no defaults. Typography rules only exist if you create them.
If you want to set typography in a child theme then add them to yours styles.css.April 6, 2023 at 4:15 am #2599285David
Thanks as always David…
April 6, 2023 at 6:23 am #2599451David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.