Okay
  Public Ticket #2233232
Using Custom fonts on Portfolio pages
Closed

Comments

  • riczito started the conversation

    Hi again,

    I have been able to install a custom font family called Museo into Elementor, following the instructions on this page : https://elementor.com/blog/custom-fonts/ It has worked great, I have been able to manually install the font on all the pages I built with Elementor.

    However, as it was installed in Elementor, the custom font doesn't show up in the regular WP Appearance > Customize font menus, so I can't choose it as a default Primary or Secondary font. This means it isn't currently being seen by the Portfolio pages, which are still displayed with the old default fonts.

    Is there any way to get around this limitation?

    Thanks, Ric

  •  675
    Neuron replied

    Hi Ric,

    You can do that with a Custom Filter on functions.php of the child theme.

    function ric_custom_fonts( $standard_fonts ){
        $my_custom_fonts = array();
        $my_custom_fonts['kitten'] = array(
            'label' => 'kitten',
            'variants' => array('regular'),
            'stack' => 'kitten, sans-serif',
        );
        $my_custom_fonts['font2'] = array(
            'label' => 'Another Font',
            'variants' => array('regular', 'italic', '700', '700italic'),
            'stack' => 'anotherfont, sans-serif',
        );
        return array_merge_recursive( $my_custom_fonts, $standard_fonts );
    }
    add_filter( 'kirki/fonts/standard_fonts', 'ric_custom_fonts', 20 );

    Note: You have to replace the text kitten as per your need.

    Please test if the fonts works on the customizer without having to add the part below, maybe it works from the Custom Fonts plugin. If not, add it like it says below.

    1. Create a folder “fonts” in the parents theme (or child theme) and upload your font files (.woff, .woff2, etc.) to the folder “fonts” via FTP.
    2. Load your fonts from style.css file of your theme (child theme) file, using the @font-face method.

    @font-face {
        font-family: 'kitten';
        src: url('fonts/kitten_light-webfont.woff2') format('woff2'),
        url('fonts/kitten_light-webfont.woff') format('woff');
        font-weight: normal;
        font-style: normal;
    }
    

    Let me know if you need further help, I'll be pleased to helpsmile.png

    Kind Regards


    Subscribe to our newsletter to get the latest updates about NeuronThemes and join our community Facebook Group.

  • riczito replied

    Thanks, that's great! I used both methods. It seemed to work, although strangely, Museo did not appear in the Customizer dropdown menus. It only appeared if I did a search for it, and even then, not all the font-weights were available. However, 500 and 700 were, which is all I required.

    Thanks once again, you guys are amazing!

    cheers, Ric

  •  675
    Neuron replied

    Hi Ric,

    You're welcome anytime. I will have a look to see why different font weights are not appearing, did that happen only for that font or for others too?

    Kind Regards


    Subscribe to our newsletter to get the latest updates about NeuronThemes and join our community Facebook Group.