Does Updating the Parent Theme Affect the Child Theme in WordPress?

The short answer is yes, you bet it does!

I use WordPress’s “twentyten” theme as a ‘parent theme’. It seems to me to be a pretty cool arrangement: I get all the benefits of a comprehensive theme such as “twentyten” while still able to give my site the look I want through the use of a child theme that I had created for such a purpose.

I created my child theme under the “twentyten” parent while still in the WordPress verion 3.0 release. I later updated the parent “twentyten” theme to the version under WordPress 3.0.1 when it came out.

Here’s what followed:

I noticed that the browsers were diplaying the page url in lieu of the proper ‘page-title’. In order to solve the problem I began some detective work – looking in header.php I found this:

1
2
3
4
5
6
7
8
9
10
11
<p>
<title>
    <?php>
        /*
         * Print the &lt;title&gt; tag based on what is being viewed.
         * We filter the output of wp_title() a bit -- see
         * twentyten_filter_wp_title() in functions.php.
         */

        wp_title( '|', true, 'right');
    ?>
</title>

So I opened up functions.php to examine the “twentyten_filter_wp_title()” function to try to figure out where things were going wrong and why I was not not seeing a proper ‘page-title’ in the browser, but alas, this particular function was missing from functions.php.

It then occurred to me to have a look at functions.php from WP version 3.0, and sure enough I found that the missing function did exist in that version and copied it into my functions.php. In addition, I noticed, that in WP version 3.0.1, the header.php of the “twentyten” theme had changed too and so I incorporated those changes into my child theme’s header.php as well.

Finally, the ‘page-title’ showed up in my brower, but now, the ‘site-name’ portion of the page-title was showing up in duplicate. After some trial and error, I commented out the “add_action..” statement at the end of the “twentyten_filter_wp_title()” function that I had copied and finally, everything worked perfectly! At least it did then at around 4 am. and I called it a night..

The next day, I noticed some strange behaviour around urls and permalinks, and wasted more time than I care to think about trying t figure out why things were suddenly so screwy. As a first step in troubleshooting I undid the changes I had made to functions.php late the night before and the urls/permalinks problem went away. I noticed that the proper page-title was still being displayed and it took me a moment to realize that this was because I now had a version match for both the functions.php and the header.php.

The ‘page-title’ issue had stemmed from the mismatch between the WP version 3.0 based header.php in my child theme and the WP version 3.0.1 based functions.php for the parent theme.

Sometimes it appears that things have gone wrong “for no reason”, but just because you did not find the reason, does not mean that it does not exist.

I now know that updating the parent theme can wreak havoc on the child theme. I will definitely be much more careful in future about upgrades to the parent theme and how they might affect my child theme. In fact, I may be so careful, that I will no longer even touch touch the parent theme, but then again, I might.. :)

In any case, live and learn!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>