Making a Weaver II Child Theme

Often we are asked how to do this or that with the Weaver II theme, and often the correct answer is: “Make a Weaver II Child Theme”. Weaver II has been designed to make it as easy as possible to create a child theme. This FAQ is a basic HOW TO for making a Weaver II child theme. Note: this is a pretty advanced topic, and really applies only to people who understand the WordPress file structure, as well as at least a little about PHP. (It is possible to copy PHP files to the right place, and make fairly simple changes to wording in them with no real programming experience – but a bit of programming knowledge is very helpful.)

What is a Child Theme?

A child theme is a mechanism provided by WordPress that allows you to selectively override or replace many of the files and specific functions found in what is known as a parent theme. This process involves creating a new directory in the /wp-content/themes directory, and following specific naming guidelines, and other conventions. This is explained in some detail here in the WordPress.org codex.

Why Would You Need a Child Theme?

If you need to change the behavior of Weaver II in a way that requires changing one of the theme’s PHP files (e.g., you can’t do it using an existing option or via custom CSS), then the only correct way to do that is a via a child theme. You should NEVER edit any of the files in the standard Weaver II theme directory (or any other theme, for that matter). The main reason for this is the fact that if you directly edit any theme files, then the next time the theme is updated, your changes will disappear. Using a child theme prevents this loss.

Basic Example included with Weaver II

To help make this process easier, Weaver II already includes a very simple example child theme in the /wp-content/themes/weaver-ii/weaver-ii-child-demo directory, included with the Weaver II theme distribution.

To use this child theme demo, copy the entire directory /weaver-ii-child-demo to the /wp-content/themes directory. You should now have a new theme available under the Appearance:Themes panel. (Hint: if you’re lost now, or don’t really know how to copy this directory to the noted location, you may need to acquire a bit more understanding of how WordPress works and uses your host file system before tackling a child theme.)

This demo version does two simple things. First, it demonstrates how to override a specific “standard” Weaver II function to override the “Continue Reading…” link used on excerpts. That is found in the functions.php file, and provides a function called weaverii_continue_reading_link. Because the standard Weaver II functions.php file wraps that function¬† in an
if (!function_exists(‘weaverii_continue_reading_link’))
statement, the definition in the child’s functions.php will override the original. Weaver II wraps many functions like that to make it easy to override specific functions. However, it will be up to you to find which functions you might want to override in your child.

The other thing included in the demo is an alternate 404.php file, which demonstrates how you can create a custom 404 page for your site. Weaver II uses a somewhat complex file organization, but all conform to WordPress naming standards, and can be replaced by equivalent child theme files, just as the 404.php file can.

Weaver II Pro vs. Weaver II basic

WordPress child themes are based on a specific parent theme located in a specific directory. Because Weaver II basic and Weaver II Pro are really two different themes in two different directories, you will need to take this into account. The example child style.css file is set up for Weaver II basic, but includes the appropriate alternative path for Weaver II Pro.

Weaver II Settings

Weaver II saves all its options in the standard WordPress database. All versions of Weaver II – the free version, Weaver II Pro, and any child theme will all use the same database entry. However, because of the way WordPress treats separate themes, you might find that some settings such as the header image, custom menus, and widget areas may need to be reactivated or redefined for different versions of Weaver II.

Child Theme Summary

  1. Read the Child Theme article at WordPress.org.
  2. Copy the /weaver-ii-child-demo directory to the /wp-content/themes directory. You may want to rename that directory to something you like: /weaver-ii-my-child, for example.
  3. Edit the child style.css file to give your child theme whatever name you want. Change the @import statement as appropriate for Weaver II basic or Weaver II Pro. Having a properly defined style.css file is required for all child themes.
  4. Add your own custom CSS at the end of the child style.css file if appropriate. Delete the demo CSS rules already there.
  5. Edit the child functions.php file to delete the example function, and add any other override functions you need for your child theme. Providing a child functions.php file is not required for a child theme.
  6. Create an appropriate set of override files, similar to the example 404.php. You may want to delete the example 404.php file. Providing override files is not required for a child theme.
  7. If desired, you might want to create an alternate screenshot.png file for your child.

Comments are closed.