How To: Add New Google Fonts To Your Theme

With Organic Themes, we believe some functionality should be reserved for plugins, not theme options. Adding or changing fonts within your theme is one of those features.

In this tutorial we will explain how to manually add new fonts within the code using Google Fonts, and how to change fonts using a plugin.

The History of Fonts on the Web

I think it’s important to give a brief history of fonts on the web. Until somewhat recently, changing fonts on a website was limited to only a handful of core fonts for the web. There were workarounds using Flash and images, but it was a painstaking process. With the creation of solutions like the CSS rule @font-face, free solutions like Google Fonts and paid services like Typekit — the web finally became a place for good (or bad) typography.

Of the many new solutions, my recommendation is to use Google Fonts when changing fonts in your theme. It’s free, easy and there are plenty of great fonts available. There are plenty of bad fonts available as well. A lesson in typography may be worth considering if you don’t have a design background. If you do have a design background, but the Google font Montserrat just doesn’t cut it as a replacement for Avenir, than you may want to consider using @font-face. However, it will require a license to use the web font and hosting the font files on your server. Using Google Fonts skips that messy stuff, and that will be the focus of this tutorial.

Manually Adding A Google Font

Within Organic Themes, there are 2 files that will need to be edited in order to manually add a Google Font — the style.css and header.php files. I’m going to cover adding a single Google Font to your theme, but the process is similar for adding a “collection” of Google Fonts to your theme.

This is roughly a 10 minute process. If the manual integration isn’t for you, skip to the plugin section to speed things along.

Okay, let’s dive in:

Step 1. Cruise over to Google Fonts and choose your desired font. This is probably the most time consuming portion of the whole process.

Step 2. When you have found that perfect Google Font, choose the Quick Use button as illustrated below. We will be using Montserrat as our example.

google-fonts-quick-use

Step 3. On the Quick Use page, select the font weights and styles you wish to use in the theme.

Step 4. Upon selecting your styles, Google will provide code similar to this:

The code should be added before the closing </head> tag in the header.php file located within the Appearance > Editor section of the WordPress admin, then choosing “Header” from the list of template files on the right. Update the file after the code has been added.

Step 5. Now we need to tell the theme where the new font should be used. That is accomplished within the stylesheet. Still within the Appearance > Editor section, choose “Stylesheet” from the list of files on the right.

Fonts are generally applied to the body and heading classes within the stylesheet. However, there are instances where fonts may be applied to other elements within a theme, such as buttons, forms, etc. Generally, the focus will be on changing the body and heading fonts. As an example, changing the body font may look something like this:

Body class with old font:

Body class with new Google Font applied:

Note: Google Fonts should always be surrounded by single quotations.

Step 6. Update the stylesheet with the new changes, and your new Google Font will be applied to all body text throughout your theme. This same process applies to changing other fonts within the theme.

If your new font isn’t displaying, make sure the font name is spelled correctly, it’s wrapped in single quotes and has a comma after the font if necessary. Also, if you have a caching plugin active, you may need to delete the cache before noticing the change.

Within Organic Themes, every theme stylesheet has a table of contents. The body class is always the first style. This should make it easy to locate your body class and headings for manually changing fonts.

Using A Plugin

If you don’t want to mess with any code, there are plenty of great WordPress plugins available for changing fonts within your theme.

We recommend the Easy Google Fonts plugin. This plugin will load the entire Google Font directory into WordPress. Using the Appearance > Customizer, you can easily change the body and heading fonts, colors and styles within your theme.

Remember to choose your fonts wisely. Legibility is one of the most important factors to consider when creating a professional website. And never use Comic Sans or Papyrus.

Reference: Reading Settings

reading-settings

Your WordPress Reading settings.

Displaying the home page within our themes requires making sure your Reading settings are setup properly.

Navigate to Settings > Reading in your WordPress dashboard and select the ‘Your latest posts‘ option to ensure that your theme’s home page displays as per the theme demo. Because of how our themes are setup with a home page as the default page display, this will not show a blog post index (as you might expect). If you are interested in the reason, please see the Codex article on the WordPress Template Hierarchy.

How To: Setup The Home Page Slider

In this tutorial we will describe the process of setting up the ‘Home’ featured content slider.

Reference:

Quick Start Guide (Setting the ‘Home’ page template)
Featured Video
Featured Images

1. Once the ‘Home‘ page template has been set, navigate to Appearance > Theme Options (Appearance > Customizer in newer themes) and under the ‘Homepage‘ tab set a category for the home page slider (Note: The naming of the ‘Homepage’ tab might depend on theme, e.g. you might see ‘Home’ instead of ‘Homepage’).

2. If you see only one or two options, ‘All Categories‘ and/or ‘Uncategorized‘, it means that you have not published a post in the category you wish to show in the slider. Once you create your desired slider category (Posts > Categories), you will need to publish at least one post before it is selectable in your theme options.

3. Once the slider is setup, you can select a post number to determine the number of slides shown, as well as a transition timing within your theme’s options panel.

Note: Each slide in the slider is a post with a Featured Image or Featured Video assigned. This means that if you want ten slides, you will need to publish ten posts within your slider category.

excerpt

Adding an excerpt may be necessary to display text in the slide.

Note: In our newer themes you may not see a text excerpt appear over the slider image. If you do not see text and would like to show it, edit one of your slider posts (Posts > All Posts), and to the top-right of your dashboard, on the post editor screen, you will see a tab that says ‘Screen Options‘ — click it. Once clicked, check the box beside the word ‘Excerpt‘. This will generate a new Excerpt meta box immediately beneath the main editor. The text that you enter here will be shown in your slider, along with the post title.

That’s it!

Quick Start Guide

In this tutorial we will provide instructions for using your theme’s home and page templates.

Reference:
Page Templates (WordPress Codex)
Using Page Templates (Organic Themes Tutorial)
Appearance Menus Screen (WordPress Codex)

Setting the ‘Home’ page template
  1. Navigate to Settings > Reading, and select the ‘Your latest posts‘ option. This will set the home page template as seen in your theme’s demo.
  2. Once set, navigate to Appearance > Theme Options (Appearance > Customizer in newer themes) to begin configuring your home page.
Setting the ‘Full Width’ page template
  1. Navigate to Pages > Add New, and create a new page.
  2. From the ‘Page Templates‘ drop-down menu, select the ‘Full Width‘ page template option. Save and publish.
  3. Navigate to Appearance > Menus to add your full-width page to your (custom) menu.
Setting the ‘Blog’ page template
  1. Navigate to Pages > Add New, and create a new page.
  2. From the ‘Page Templates‘ drop-down menu, select the ‘Blog‘ page template option. Save and publish.
  3. Navigate to Appearance > Theme Options (Appearance > Customizer in newer themes) to configure your blog page.
  4. Navigate to Appearance > Menus to add your blog page to your (custom) menu.
Setting the ‘Portfolio’ page template
  1. Navigate to Pages > Add New, and create a new page.
  2. From the ‘Page Templates‘ drop-down menu, select the ‘Portfolio‘ page template option. Save and publish.
  3. Navigate to Appearance > Theme Options (Appearance > Customizer in newer themes) to configure your portfolio page.
  4. Navigate to Appearance > Menus to add your portfolio page to your (custom) menu.

Note: For themes with a filterable portfolio, the filters are sub-categories of the category set in step #3. For example, you could set a category such as ‘Portfolio’, then create sub-categories as filter options: ‘Photography’, ‘Illustration’, ‘Oil’, and so forth.

Using the ‘Slideshow’ page template
  1. Navigate to Pages > Add New, and create a new page.
  2. From the ‘Page Templates‘ drop-down menu, select the ‘Slideshow‘ page template option.
  3. To add images to your slideshow, click the ‘Add Media‘ button to the top-left of the page editor. Using the media uploader, upload your desired slideshow images. Note: Images must be uploaded because of the way the slideshow template is setup, which means that you cannot choose previously uploaded images from the media library unless you were to use a plugin such as Attachments.
  4. Navigate to Appearance > Menus to add your portfolio page to your (custom) menu.

How To: Install Theme Demo Content

By default, a WordPress theme does not include pre-installed content. However, if you would like to install your theme’s demo content to be used as a guide, you can do so by following these instructions.

Note: We do not recommend this if you have existing content in your WordPress installation, as it will add numerous posts, pages, categories, media and more to your site. Also, we recommend replacing all content as soon as possible to avoid negative SEO effects or image licensing repercussions.

Reference:

Importing Content (WordPress Codex)
Organic Themes Quick Start Guide

  1. Access your Organic Themes documentation page here.
  2. Download the file link called ‘Download Demo Content’ under the documentation page of your theme.
  3. Once downloaded, unzip the file you are provided. If you are using Safari’s default settings, the file will be unzipped automatically.
  4. Log into your dashboard and navigate to Tools > Import, and choose the ‘WordPress‘ importer.
  5. When prompted, upload your demo content .xml file.
  6. After you have initiated the demo content upload, you will be asked to assign or create a new author for your demo content — this is your choice. You will also be given a checkbox option to ‘Import File Attachments‘. Please do not check this box as the images in the demo are not licensed for distribution.
  7. Once imported successfully, navigate to Appearance > Theme Options (Appearance > Customizer in newer themes) and configure your content
  8. That’s it, enjoy!

If you wish to remove the demo content after installing it, you could use a solution such as the WordPress Reset plugin. Note: Using this plugin will delete ALL content within your WordPress installation. So use this plugin at your own risk.

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match