Skip to content

Importing custom Google Fonts in WordPress

WordPress themes often come with default fonts, but you may want to customize your site’s typography to match your brand. On ruachost.com, you can import Google Fonts into WordPress using a simple code snippet or plugins.

  • Free and easy to integrate.
  • Wide selection of professional fonts.
  • Improves site design and readability.
  • Loads quickly from Google’s CDN.

Method 1: Add Google Fonts via functions.php

Section titled “Method 1: Add Google Fonts via functions.php”
  1. Log in to WordPress with an administrator account.

  2. In the dashboard, go to Appearance → Theme Editor.

  3. Select your active theme and open the functions.php file.

  4. Add the following code snippet:

    // Import Google Fonts into WordPress
    function add_google_fonts() {
    wp_register_style('OpenSans', '//fonts.googleapis.com/css?family=Open+Sans:400,600,700,800');
    wp_enqueue_style('OpenSans');
    }
    add_action('wp_print_styles', 'add_google_fonts');
  5. Click Update File to save changes.

  6. Open your theme’s CSS file and apply the font:

    body {
    font-family: 'Open Sans', sans-serif;
    font-size: 20px;
    color: #000000;
    }

✅ Your site will now load and use the Open Sans font.

  • Install a plugin such as Easy Google Fonts.
  • Activate it and go to Appearance → Customize → Typography.
  • Select and apply Google Fonts to headings, body text, or specific elements.
  • Always back up your theme files before editing.
  • Use a child theme to preserve changes during updates.
  • Loading too many fonts can slow down your site, choose only what you need.
  • Ensure proper fallback fonts (e.g., sans-serif) for browsers that don’t support Google Fonts.