How do I properly use $in_footer within a php snippet?

I have a php snippet within a WordPress installation that calls for Google fonts to be loaded in a stylesheet, and it looks like this:

wp_enqueue_style( 'parallax-google-fonts', '//fonts.googleapis.com
/css?family=Montserrat|Sorts+Mill+Goudy', array(), CHILD_THEME_VERSION );

In order to load this script in the footer so Google Page Speed Insights doesn’t complain about above the fold, render-blocking stylesheets, I added $in_footer, which I got from the WordPress codex.

But I’m told this is only for javascripts, not for stylesheets.

I’m not sure how to properly do this, so I just guessed. It “worked” on Page Speed Insights, but Pingdom, etc., and others are saying there’s an unknown call to https://nationalcdp.org$in_footer/ for some reason.

Nothing on my nonprofit organization’s website appears to be off. Here’s how I added it:

wp_enqueue_style( 'parallax-google-fonts', 
'//fonts.googleapis.com/css?family=Montserrat|Sorts+Mill+Goudy', 'true', array(),
CHILD_THEME_VERSION );

Did I do this correctly, or am I way off here?

Thanks for any guidance anybody can offer!


Source: wordpress

Leave a Reply