Okay
  Public Ticket #2226291
Change font
Closed

Comments

  • Francesco started the conversation

    Hey there,

    I've read the documentation and I've found your note about changing the font.

    But I need to change the fonts via functions.php in my child theme via dequeing your fonts and enquing mine locally or via Google fonts (need to check about their GDPR policy).

    Can you please help on this achievement?

    I would write (to be completed):

    function myfunction() {       wp_dequeue_style( 'munio-main-font,munio-secondary-font' );
    wp
    }
    add_action( 'wp_enque_style', 'myfunction', 100 );
    function mysecondfunction() {
     
    wp_enqueue_style( 'aion_main_fonts', 'https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false ); }
     
    add_action( 'wp_enqueue_scripts', 'mysecondfunction' );

    Is this correct?

    Thanks and have a great day! 

    Ps it would be amazing to have in the future the possiblity to change fonts via the theme options.

  •  1,973
    Support replied

    Hi, 

    Although we do not recommend changing the fonts (because you may need to do a lot of collateral changes - margins, paddings etc) you can use plugin such Easy Google Fonts 

    https://wordpress.org/plugins/easy-google-fonts/

    or

    https://wordpress.org/plugins/use-any-font/

    or for custom fonts

    How can I add my own custom icons/fonts to the theme?

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • Francesco replied

    Thanks for your answer,

    but i don't want to use a plugin and i need to change the fonts as i said (and i've also read what your wrote about the fonts in the documentation!)

    Is the code i've written ok?

    Do i miss anything?


    Thanks

  •  1,973
    Support replied

    Hi,

    I think you should enqueue your fonts inside youser second function with

    /*
    Translators: If there are characters in your language that are not supported
    by chosen font(s), translate this to 'off'. Do not translate into your own language.
    */
    if ( 'off' !== _x( 'on', 'Google font: on or off', 'munio') ) {
    $my_main_font_url = add_query_arg( 'family', urlencode( 'Poppins:300,400,600,700' ), "//fonts.googleapis.com/css" );
    $my_secondary_font_url = add_query_arg( 'family', urlencode( 'Oswald:400,700' ), "//fonts.googleapis.com/css" );
    }

    wp_enqueue_style( 'my-main-font', $my_main_font_url, array(), '1.0.0' );
    wp_enqueue_style( 'my-secondary-font', $my_secondary_font_url, array(), '1.0.0' );

    ignore secondary font if you don't need it and replace font families and fonts weight

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy