4

I have inherited the job of editing my agency's webpage. I didn't create the site, and I am not sure whether the IMW custom theme that is active is a child type theme for 2011, or whether all customizations up to this point have been made to the original theme. Do need to create a child theme for this site, how to do that considering all the customizations that have already been applied.

What do I need to provide to support for answers

I read some of the answer posts but still am unsure. So If I do not see "Child" in the CSS, then it is not a child theme? I was thinking that maybe the IMW Custom theme was a child theme itself based on the 2011 theme, just without the word child being used to designate it as such. IF IT IS NOT A CHILD THEME, then all of the customizations up to this point have been done to the theme itself. How would I go about creating a child theme from this point? I am so confused.

  • 1
    You can disable the child theme and see what happens, typically a child theme style.css has the following tag at the top Template: parent theme name here – Wyck May 11 '14 at 15:02
  • No. That isn't really what the answers say. Read carefully. For example, you aren't looking for "Child" in the stylesheet; you are looking for "Template:" – s_ha_dum May 12 '14 at 15:11
8
  • Read the stylesheet. A child stylesheet must have Template: somethemename to function as a child theme.
  • Look in Appearance -> Themes. A child theme should have a notice about requiring a parent theme.
  • Use code similar to this (note: debugging only):

    add_action(
      'wp_head',
      function () {
        if (get_template_directory() === get_stylesheet_directory()) {
          echo 'not a child';
        } else {
          echo 'child';
        }
      }
    );
    

Reference:

http://codex.wordpress.org/Child_Themes

  • 1
    Nice collection. I like your 3rd option, but I think I would use wp_footer instead of wp_head or wrap the result inside a HTML comment <!-- --> (+1) – birgire May 11 '14 at 16:25
  • 1
    That is why I said "debugging only". The code just throws content onto the page with zero concern for layout or markup. It is purely "proof of concept". – s_ha_dum May 11 '14 at 16:26
  • 1
    I know ;-) This was actually just a comment for the other readers that are going to test this on their live sites regardless ;-) – birgire May 11 '14 at 16:32
3

Since WP 3.0 there is a function is_child_theme() that returns a bool value.

0

If you cannot find any CSS in the Appearance > Customize > Additional CSS section, but the current theme has clearly been modified from another theme, follow the Wordpress guide on Creating a Child Theme from a Modified Existing Theme.

The Wordpress explanation clearly walks through how to use a DIFF tool to identify where changes have been made. Keep in mind that this does assume you can find the original, unmodified theme. There's a link to a "worst case scenario" tutorial, which sounds like what you might be facing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.