Skip to content
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

Adding variants for custom fonts in typography #1082

Closed
rinkuyadav999 opened this issue Aug 15, 2016 · 5 comments
Closed

Adding variants for custom fonts in typography #1082

rinkuyadav999 opened this issue Aug 15, 2016 · 5 comments

Comments

@rinkuyadav999
Copy link
Contributor

Issue description:

Right now "typography" font family list is returning all Google fonts but how can we add own fonts in list of font family?

Version used:

(Did you try using the develop branch from github? There's a chance your issue has already been adressed there)
Latest form w.org

Using theme_mods or options?

theme_mods

Code to reproduce the issue (config + field(s))

simply type "typography". i just want to add custom fonts in font family list.

@aristath
Copy link
Contributor

You can use the kirki/fonts/standard_fonts filter for example:

function add_my_custom_font( $standard_fonts ) {
    $fonts['my_custom_font'] = array(
        'label' => 'My Font'
        'stack' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
    );
    return $fonts;
}
add_filter( 'kirki/fonts/standard_fonts', 'add_my_custom_font' );

@hellor0bot
Copy link

Would be great if we could also control Font Variants for custom fonts like this:

function add_my_custom_font( $standard_fonts ) {
    $fonts['my_custom_font'] = array(
        'label' => 'My Font',
        'variants' => array('300','300italic','regular','italic'),
        'stack' => '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif',
    );
    return $fonts;
}
add_filter( 'kirki/fonts/standard_fonts', 'add_my_custom_font' );

@davidwebca
Copy link

Can't seem to be able to add available variants for my custom font either...

@aristath aristath reopened this May 20, 2017
@aristath aristath changed the title Adding custom fonts in typography Adding font-weights for custom fonts in typography May 20, 2017
@aristath aristath changed the title Adding font-weights for custom fonts in typography Adding variants for custom fonts in typography May 20, 2017
@aristath aristath added this to the 3.0 milestone May 20, 2017
@aristath
Copy link
Contributor

Fixed in 3.0

@steve231293
Copy link

Hello @aristath ,

I used Kirki version 3.1.9 but font variants not working properly.

$fonts['Butler'] = [ 'label' => 'Butler', 'variants' => [ 200, 300, 400, 500, 700, 800, 900, ], 'stack' => 'Butler, sans-serif', ];

I have addd custom font okay but in Customize variants only show 4 variants: regular, itatlic, 700, 700italic.

Could you check and fix it?

Thanks in advanced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants