Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Child Themes

Note that a function in a child theme’s functions.php can only override a function in the parental functions.php, if the parent’s function is enclosed in a function_exists statement. Overriding does not happen automatically. Demetris 12:27, 13 April 2010 (UTC)

External Links

I believe it is not possible to enhance the Child Themes article to the point that it offers all the detailed examples and the detailed information found in well-written tutorials on the internet. For this reason, I have been meaning to add a couple more external links, not remove the couple that I started with. I have not done so yet, because I want to make a careful selection. I know that I am in a sensitive position here, since I am the author of one the linked articles, but then, what am I to do? Not link to something good because I wrote it? Or banish external links completely from the article? Don’t know... Still working on the text, anyway, trying to improve it and make it more comprehensive, regardless of what links/resources it offers. Demetris 15:12, 16 April 2010 (UTC)

To Demetris - That statement about "not possible to enhance the Child Themes article" makes me suspicious. --MichaelH (talk) 17:21, 16 April 2010 (UTC)
To MichaelH - What I meant was that if the Codex article was to cover every detail and go into every example that is covered by well-written external articles on the subject, it would have to grow to unmanageable lenghts, more than 5.000 words. My introduction at op111.net is 3.000 words, and it only covers the stylesheet part of child themes. Do we want such a long article in the Codex just for Child Themes? It would be unmaintainable in my opinion. (And so its quality would suffer in the long term.) Demetris 19:05, 16 April 2010 (UTC)
I don't know to be honest with you Demetris. We have a fine line to judge over what to keep here and what to allow to be linked elsewhere. It is not always obvious who is doing things for the best intentions. Sometimes we end up removing links, other times they are left. It is not always simple to make the decisions. We do value your input also. mrmist 20:29, 16 April 2010 (UTC)

Required Files

The only required file is style.css. User "Negatif" changed that to include index.php, which is not required.

editor-style.css in child theme?

Now that there's [easy] support for TinyMCE styles in the theme, it seems info about this should get added to the Codex. I just observed that in Twenty-Eleven, putting an editor-style.css file in the Child Theme folder is additive (that is, editor-style.css in both the parent and child themes are used without an @import statement in the child theme). I don't know enough to write the section, but it seems like someone who does could make really valuable contribution to this page by adding info on editor-style.css. It seems to clearly be an exception.

Theme differences

I've spotted a problem in code examples that can lead to confusion: - twintyten and twentyeleven uses id selectors whereas twentytwelve uses class.

 #site-title vs .site-title

Default Theme Directory

In the first example of creating theme header for the child theme, currently it is showing twenty-fourteen in template. The default theme shipped with WordPress currently is in twentyfourteen directory. If a beginner level user copies the example stylesheet code as it is, their child theme will not be able to find the parent theme's directory or its stylesheet. Even though this is just a sample code and technically correct. But if we are using twentyfourteen as referrence, I think we should use it correctly.

Organization of this entry

Hi all. The formatting of this entry is a bit... strange. Are there any objections if I move all of the CSS related info to the top of the article (under the 'How to Create a child Theme' header)? Right now there's information on the stylesheet header, followed by information on how to enqueue the parent theme stylesheet, but then (prior to my edit), instructions on enqueuing the child theme stylesheet were somewhere near the bottom. Imo, this makes the entry unintuitive and confusing for the uninitiated (no offence intended to the present authors). Some of the phrasing / word choice could also be improved for flow / clarity. Thanks! JPaavola (talk) 15:21, 17 December 2014 (UTC)


Go for it! -Jdgrimes (talk) 17:05, 17 December 2014 (UTC)

Hopefully my submission is solid :S JeremyP (talk) 02:14, 18 December 2014 (UTC)

where?

where does the require once go? in functions.php?

require_once( get_stylesheet_directory() . '/my_included_file.php' );

TY. (=


Yes, in functions.php. -Jdgrimes (talk) 12:37, 4 November 2015 (UTC)

Instructions referencing plugin

The instructions for creating a child from an already modified parent theme seem to reference use of a plugin. The plugin 'Child Theme Configurator' possibly. In any case, the instructions starting at step 2 don't give information about navigating to that functionality. Cindio (talk) 18:14, 20 September 2016 (UTC)

I have added a link to the plugin in question. (I have used this plugin; I feel these instructions are still a mish-mash of plugin instructions and regular instructions.) I also added a link to how to accomplish this without the use of a plugin. Kjodle (talk) 15:29, 29 May 2017 (UTC)

Required files/plugins

I have removed the "The only required child theme file is style.css…" line, since a functions.php file is now required to enqueue parent stylesheets properly.

Kjodle (talk) 15:22, 29 May 2017 (UTC)