Tagged: x
-
AuthorPosts
-
August 18, 2016 at 1:10 pm #1137236
cwallaceParticipantGreetings, X team…
I’m using some Google fonts in addition to those being loaded by Integrity (in this case, Droid Sans and Droid Serif). What I’d like to do is dequeue yours and re-enqueue with all the fonts in a single request. What I’ve tried is as follows:
// dequeue X Theme’s fonts, then re-enqueue all fonts in a single request
wp_dequeue_style( ‘x-google-fonts-css’);
wp_deregister_style (‘x-google-fonts-css’);$family = “Droid+Sans:400,400italic,700,700italic|Droid+Serif:400|” .
“Julius+Sans+One|Great+Vibes|Playfair+Display+SC”;$query_args = array(‘family’ => $family);
wp_register_style ( ‘my-x-google-fonts-css’, add_query_arg( $query_args,
“//fonts.googleapis.com/css” ), array(), null );
wp_enqueue_style ( ‘my-x-google-fonts-css’ );The above is called by:
add_action( ‘wp_enqueue_scripts’, ‘my_script_cleaner’, 999 );This didn’t work; it still loads yours, containing Droid Sans and Droid Serif, and then adds mine with all five fonts in the request.
Not being easily discouraged, I then added:
function custom_dequeue_x_fonts() {
wp_dequeue_style(‘x-google-fonts-css’);
wp_deregister_style(‘x-google-fonts-css’);
}add_action( ‘wp_head’, ‘custom_dequeue_x_fonts’, 9999 );
This attempts for force the situation by dequeueing at the last possible minute — which also didn’t work. Grrr! So, I’m thinking you have a dependency where “x-google-fonts-css” is always going to load, no matter what.
Can you think of a way I can combine my additional fonts with yours in a single server request?
Best regards,
ChrisAugust 18, 2016 at 2:11 pm #1137322
cwallaceParticipantOops…never mind…
While working on a similar situation, I realized I had the handle wrong — it’s not “x-google-fonts-css” but simply “x-google-fonts” — it appears WP adds the “-css” to the handle when it spits out the link in the head section.
Regards,
CAugust 18, 2016 at 2:29 pm #1137361
JadeModeratorGlad to hear you got it sorted C.
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1137236 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
