DesignMe Creative Group

207.776.5416 • MAINE & ARIZONA

fb pintrest rssicon
  • Home
  • Services
    • Websites & Social Media
    • Marketing & E-Newsletters
    • Logos & Print
    • Training & Support
  • Portfolio
    • Website Design
    • Creative Design & Branding
    • Social Media & E-Marketing
  • The Team
  • Why DesignMe?
    • Our Philosophy
    • Affordable Prices
    • Getting Started
  • Blog
  • Payment
  • Contact

May 23, 2022 By Debbie Leave a Comment

Enqueue CSS2 Google Fonts

You may find that some of the themes you choose call out google fonts in the “old way”, but when you go to grab your fonts, it looks a tad different. One would think it was as simple as adding the “css2” to the front and the new family codes in the middle.

That’s not the case!

Instead, you need to add a little bit extra to the end. Here is a sample of the “old way” and the “new way” using a Genesis theme from Studiopress:

Old Way

add_action( 'wp_enqueue_scripts', 'agentpress_google_fonts' );
function agentpress_google_fonts() {
	wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:100,300,400,400i,700,700i|Libre+Caslon+Display&display=swap', array(), CHILD_THEME_VERSION );
}

New Way

add_action( 'wp_enqueue_scripts', 'agentpress_google_fonts' );
function agentpress_google_fonts() {

	wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=PT+Serif:wght@400;700&display=swap', array(), null );
}

Here, I added the entire information from google fonts … plus “array(), null ” and that did the TRICK!

Filed Under: Code Tips, Just Because, TechTalk, Website Design, WordPress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Site Search

Tech Talk

  • Enqueue CSS2 Google Fonts
  • Redirect to the BuddyPress Profile Page
  • “Going Live”
  • Insert Soliloquy Shortcode Using Advanced Custom Fields
  • Redirect My Website To https://

Creative Corner

  • Unique Websites Deserve a Unique Login
  • Adding A Shortcode To The Post Title
  • Favicons – A Tiny Graphic With Big Impact
  • Social Media Icons – So Many Options!
  • Savage Chicken iMugs

From Our Blog

  • The “ME” In Our Name Really Means YOU
  • Behind Your Website
  • I Have a Website – Now What?
  • Full Width (100%) Section On A Fixed Width Page
  • Small Can Mean Big When It Comes To Websites

View Topics

creative

Functional

affordable

Copyright © 2023 · Custom Website by DesignMe Creative Group · Log in

Hosted Locally by Maine Hosting Solutions