-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google fonts? #32
Comments
Hey there! You can add a dropdown containing all the google fonts like this: $controls[] = array(
'type' => 'select',
'setting' => 'font_menus_font_family',
'label' => __( 'Menus font', 'maera_bs' ),
'section' => 'typo_nav',
'default' => '"Helvetica Neue", Helvetica, Arial, sans-serif',
'priority' => 40,
'choices' => Kirki_Fonts::get_font_choices(),
); |
You can also include the subsets... $controls[] = array(
'type' => 'select',
'setting' => 'font_base_family',
'label' => __( 'Base font', 'maera_bs' ),
'section' => 'typo_base',
'default' => '"Helvetica Neue", Helvetica, Arial, sans-serif',
'priority' => 20,
'choices' => Kirki_Fonts::get_font_choices(),
);
$controls[] = array(
'type' => 'multicheck',
'setting' => 'font_subsets',
'label' => __( 'Google-Font subsets', 'maera_bs' ),
'description' => __( 'The subsets used from Google\'s API.', 'maera_bs' ),
'section' => 'typo_base',
'default' => 'latin',
'priority' => 22,
'choices' => Kirki_Fonts::get_google_font_subsets(),
); |
Hi |
The above code will simply save the font you have selected in the database. |
ok i got your point, i am asking above question because some Framework support auto Google font attachment in wp header after choosing Font from Dropdown , this feature available in titan framework. |
Hi @aristath I found this Issue thread for google fonts, so posting my the issue here. Scenario:
I have tried using get_theme_mod as you mentioned above. here is the code:
Please help me on this. Thanks |
Hello again! I've been building this for the past 2 days... I believe it's working now. $controls[] = array(
'type' => 'select',
'setting' => 'body_font_family',
'label' => __( 'Main font', 'textdomain' ),
'section' => 'typography',
'default' => '"Helvetica Neue", Helvetica, Arial, sans-serif',
'priority' => 40,
'choices' => Kirki_Fonts::get_font_choices(),
'output' => array(
'element' => 'body',
'property' => 'font-family'
)
); This will generate automatically all necessary CSS and output it to the head, and additionally also add the required You don't even need your custom CSS function as posted above... 😄 Can you please test that and let me know if it works for you? |
Thanks @aristath its work fine. |
Awesome! I'm closing this issue. |
Hi
i see there Class(class Kirki_Fonts) created for Google font but define any way how to use it.i am using this plguin in theme , if you provide any way or idea how to add Google fonts it would be grate .
Thanks
The text was updated successfully, but these errors were encountered: