Putting things where they belong


This post serves as a repository for all of the items I discussed during my 2014 WordCamp Tampa talk called “Putting things where they belong: child themes and functionality plugins“.

In my talk, I went through how to set up a child theme and a functionality plugin for your site, so that you can make changes to your site in the correct manner, without putting your edits, or the rest of your site at risk.

Download the slide deck

If you’ve already seen the talk and just need the templates, here’s a link to them for your convenience. The rest of you, read on and the download links will be available again further down the article.

Download the child theme templateDownload the functionality plugin template

The different types of change

I outlined three different types of changes that you might want to make to your site:

  • The first type is style changes. This changes the appearance of certain elements by modifying their font, color, margin, padding, size etc. These types of change are CSS changes, and belong in your child theme’s stylesheet.
  • The second type is layout changes. This changes what elements of your site appear in what locations. For example, it determines whether the front page should use the site title or a logo, where the menu should be, and what information should go in the footer. These types of changes are done by adding layout files to your child theme.
  • The third type of change is functionality changes. These change how your site operates. Examples of such changes might includes registering a custom post type, or adding tracking codes (like Google Analytics) to each page. These types of changes may belong in your child theme or in a functionality plugin.

The first two are cut and dry: they belong in your child theme. The third one is a little less sure. Why the uncertainty? This can be answered by asking the following question of each functionality change you want to make:

Will this change still apply when I change themes?

If the functionality change applies strictly to your theme, it will belong in the functions.php file in your child theme. If you’re going to want this change to persist after you change your theme in a few years (or next week), it belongs in your functionality plugin. Here’s some examples to help you decipher the difference:

  • You want to add a new menu to the footer in your WordPress. You need to register the new menu using register_nav_menu(), but where does it go? Because this one is tied to the theme, it belongs in functions.php (your child theme). Once you change your theme, the appearance is going to change, and your menus will move all over again, so this function will no longer apply at that point.
  • You want to register a new custom post type, which you’ll do using the register_post_type() function. This one belongs in your functionality plugin. After you switch themes, you’re not going to want to lose this content, so by keeping the function in your functionality plugin, it will still be available after you change themes.
  • You want to add your Google Analytics tracking code to the <head> of each page. Again, because you’re going to want to continue tracking your users after you change themes, this one belongs in your functionality plugin.
  • You want to register a new sidebar (using register_sidebar()) which will appear on certain pages. Because this affects the appearance of the site and how the theme displays your content, this one belongs in your child theme’s functions.php.

Now that you know what belongs where, let’s create a child theme and a functionality plugin.

7 thoughts on “Putting things where they belong”

  1. Rob says:

    First of all, thanks for this and the template files, very useful. However, I did run into a difficulty where the child css appeared to be loading before the parent css. I’ve found a solution, but haven’t put any time into documenting the the specifics of the functionality (client is breathing down my neck don’t you know). I modified your functions template:

    /* Ensure that the child theme’s css loads after the parent theme’s css. */
    function load_theme_css() {
    wp_enqueue_style( ‘parent-theme’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-theme’, get_stylesheet_directory_uri() . ‘/style.css’ );

    add_action( ‘wp_enqueue_scripts’, ‘load_theme_css’ );

    I haven’t tested it thoroughly, but it appears to do the trick.

    1. Hmmm, that’s quite bizarre, but I’d certainly advise against enqueuing the child theme CSS as any active theme already has it’s CSS enqueued automatically.

  2. smtz says:

    Hi Dave,

    I have create a child theme but it seems that my child theme is not connected to the parent theme as the look and feel
    of the child theme is a bit wrong, below is what i have done till now:

    Created the child theme in theme directory.

    Theme Name: Child Theme
    Theme URI: Website name
    Author: smtz
    Author URI: Website name
    Description: Child theme
    Text Domain: child-theme
    Template: parentthemename

    @import url(“../parentthemename/style.css”);


    content of child funtion.php

    Can you pls point out what is wrong, i’m really beginner in this. Thanks in advance. :)

    1. If this is the code you used, it is because you did not update parentthemename to the actual parent theme name.

  3. skeeterz71 says:

    ” but I’d certainly advise against enqueuing the child theme CSS as any active theme already has it’s CSS enqueued automatically.”

    I imagine you know by now that enqueuing a WordPress child theme style css is the WordPress codex recommended way of doing it. https://codex.wordpress.org/Child_Themes

    1. “Your child theme’s stylesheet will usually be loaded automatically. If it is not, you will need to enqueue it as well.”

      If your child theme styles are in style.css, you should not need to enqueue any CSS in your child theme. However, if you put your child theme’s CSS elsewhere (to help with versioning for instance), then you would need to enqueue it.

  4. Barleo says:

    O wow this exactly what I am looking for but need it watered down a bit. I am a newbie and want to learn how to become a genesis child theme designer because I want to sell child themes to my niche. I understand the gist of what you are doing but cant seem to put it into action. I get as far as creating the child theme and understand about uplaoding php files but the rest is a haze. Do you happen to know of a step by step video for beginner wanna be designers…LOL.
    Thanks so much very informative site just wish I new terms better or how they all work together because I am not a developer.

Leave a Reply