• Resolved cmgdesigns

    (@cmgdesigns)


    Hi,

    I’m running a child theme and I want to combine three of the Google fonts from the parent into one api call. I think I figured out the code for that (below).

    I ran it through GTMetrix and it calls it, but it also continues to call them separately. I tried the wp_dequeue_style. It worked on a different font, but not these three.

    Plus, not only am I seeing them being called through fonts.googleapis, but again at fonts.gstatic.com in GTMetrix, though not on the page that I see. Why would that be? A plugin calling it? I couldn’t find the gstatic version in the parent’s function.php.

    Any ideas would be greatly appreciated. Thanks.

    Combining all three:

    function prefix_fonts() {
    
        wp_enqueue_style( 'prefix_fonts', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700|Lato|Roboto+Slab:400,700', array(), null, 'screen' );
    }
    add_action( 'wp_enqueue_scripts', 'prefix_fonts' );

    Code I used to try to dequeue (worked on Droid Arabic Kufi):

    ‘function remove_default_stylesheet() {
    wp_dequeue_style( ‘droidarabickufi’ );
    wp_dequeue_style( ‘lato’ );
    wp_dequeue_style( ‘roboto-slab’ );
    wp_dequeue_style( ‘open-sans’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘remove_default_stylesheet’, 11 );’

Viewing 3 replies - 1 through 3 (of 3 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Which theme are you working with? Maybe the author has a better stance at understanding the issue than us

    Thread Starter cmgdesigns

    (@cmgdesigns)

    It’s a themeforest theme (Logger) but my support time period is up so I was trying to figure this out myself. I’ll reach out to see if he can at least point me in the right direction.

    Is the above code at least correct for what I’m trying to do? Thanks.

    Thread Starter cmgdesigns

    (@cmgdesigns)

    For anyone interested. I was able to figure it out. I needed to use deregister instead of dequeue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Combine Font API Calls In Child Theme Issu’ is closed to new replies.