Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #946519

    Hi,

    until I updated to ENFOLD 4.3 I used this function for adding own Google fonts and it worked perfectly:

    add_filter( 'avf_google_heading_font', 'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    {
    $fonts['Dosis'] = 'Dosis:300,400,500,600,700';
    return $fonts;
    }
    
    add_filter( 'avf_google_content_font', 'avia_add_content_font');
    function avia_add_content_font($fonts)
    {
    $fonts['Dosis'] = 'Dosis:300,400,500,600,700';
    return $fonts;
    }
    
    function avia_add_google_fonts() {
    wp_enqueue_style( 'avia-google-fonts', 'https://fonts.googleapis.com/css?family=Cinzel+Decorative:400,700' );
    }
    add_action( 'wp_enqueue_scripts', 'avia_add_google_fonts' );

    I use “Dosis” in the theme settings as my headline font – so far, so good.
    “Cinzel Decorative” is only used for some other things like quotes etc.

    With ENFOLD 4.3 I get now this error message on top of my backend:

    Warning: file_get_contents(/www/htdocs/w012345/mysite/mysitenetwork/https://fonts.googleapis.com/css?family=Cinzel+Decorative:400,700): failed to open stream: No such file or directory in /www/htdocs/w012345/mysite/mysitenetwork/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/asset-manager.class.php on line 322

    Especially the first mentioned path there is really strange: www/htdocs/w012345/mysite/mysitenetwork/https://fonts.googleapis.com/

    Is the function mentioned above not longer valid?

    There seems to be a mistake in using the wp_enqueue_style part of the function mentioned above, because “Dosis” font works correctly at my site, “Cinzel Decorative” does not.

    Note:
    – I am using a multisite and ENFOLD is installed in a subfolder for a sub-site, if this is important to know for you.
    – ENFOLD is the parent theme, I DO NOT use a child theme in this case!

    Could you please give me the right function how to add my own Google fonts for using them in the theme settings? Thanks.

    #946689

    i know that code as well – but try this one – maybe it works (too)

    add_action('wp_head', function() {
    ?>
    	<link href="https://fonts.googleapis.com/css?family=Cinzel+Decorative:400,700" rel="stylesheet"> 
    <?php
    });

    Or your code only with false at the end – but try first the top code

    function avia_add_google_fonts() {
    wp_enqueue_style( 'avia-google-fonts', 'https://fonts.googleapis.com/css?family=Cinzel+Decorative:400,700', false ); 
    }
    add_action( 'wp_enqueue_scripts', 'avia_add_google_fonts' );
    #946755

    The first one works fine, thanks a lot!

    #947612

    Hi,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.