Breaking things to fix others

I know, that I promised not to break existing child themes with future versions of Thematic. But sometimes it is necessary to break things ’cause we need to fix others.

With the last revision I fixed an issue, where wp_page_menu() got the class sf-menu permanently. Plugin and Widget Developers suffered from headaches because of that. To get rid of this issue I had to change the way Thematic called wp_page_menu().

The old call:


And the new call:

echo thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));

The parameter echo changed from TRUE to FALSE.

If you use the standard procedure as described in the sample child theme to add a ‘Home’-link to your menu, your menu will come up without any styling. To fix this behavior you need to remove the parameter echo from your function. It should look like this to work with the latest SVN revision:

function childtheme_menu_args($args) {
	$args = array(
		'show_home' => 'Home',
		'sort_column' => 'menu_order',
		'menu_class' => 'menu',
		'echo' => false
	return $args;
add_filter('wp_page_menu_args','childtheme_menu_args', 20);

If you use wp_page_menu() in other locations than the header and you need Superfish, make sure that you use the above mentioned call

echo thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));
This entry was posted in Announcement and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. xxxevilgrinxxx
    Posted April 24, 2010 at 18:52 | Permalink

    thanks for the head’s up, Chris!
    I am using version .9.6.1 of Thematic ( I haven’t really figured out SVN yet), so would this be an issue for me?

    I’ve noted the change to echo, but as I use the wp_page_menu twice in my functions, can you let me know what changes I may have to make, if any?
    relevant code:

    // Adds a home link to your menu
    function childtheme_menu_args($args) {
    $args = array(
    'show_home' => 'Home',
    'sort_column' => 'menu_order',
    'menu_class' => 'menu',
    'echo' => true
    return $args;

    //add links to the menu
    function child_add_menu_items($output) {
    $my_code = 'Question EverythingThe Shelf';
    return str_replace('',$my_code, $output);

    I haven’t noticed any difference to my theme yet, nothing appears to be broken….but it’s coming, isn’t it :)
    Thanks in advance for any help you can offer!

    • Posted April 25, 2010 at 20:35 | Permalink

      Yes .. it will come ;-)

      I guess, that both menus are Superfish styled. In this case you need to integrate the changed childtheme_menu_args().

      If you could post your second wp_page_menu() call, I can tell you what needs to be changed-

  2. Posted May 9, 2010 at 02:47 | Permalink

    Thanks for this Chris. Had me stumped for a little while after I updated a site – glad I came across this. Cheers!

  3. Posted May 10, 2010 at 00:34 | Permalink

    Just wanted to say: LOVE the new theme you’ve got here for Thematic 4 You, Chris!

  4. kathy
    Posted June 29, 2010 at 19:13 | Permalink

    man i was racking my brain trying to figure out where that ul class disappeared to until i remember you’d written a post about breaking something in thematic. much relief. how is the approval going w/ getting the new version into WP?

  5. thomas
    Posted October 20, 2010 at 02:54 | Permalink

    add_filter(‘wp_page_menu_args’,’childtheme_menu_args’, 20);

    have a look at the priority 20 !!!

  6. Posted October 26, 2010 at 18:42 | Permalink


    Thanks for the new version of Thematic. Just installed it and it broke the menu on my child theme, but I was able to find the solution in this blog post. I had filtered out some of the pages and when I upgraded, my code in functions.php was no longer filtering out some links.

    Thanks again!

  7. Jerry
    Posted October 27, 2010 at 16:04 | Permalink

    Hi Chris, just updated to Thematic version I got my website running in dev with some minor CSS fixes, but the second level of my menu has dissapeared. I went through various threads on the Thematic forum, but can’t figure out how to solve my specific problem.

  8. JeffM
    Posted December 7, 2010 at 16:42 | Permalink


    Thanks for a terrific theme, I just want to bring something to your attention…

    If you’re monitoring your PHP error logs, you’ll see that your filter code snippet throws 2 exceptions:

    [8: Notice] Undefined index: link_before [...]\wp-includes\post-template.php Line: 845 and
    [8: Notice] Undefined index: link_after [...]\wp-includes\post-template.php Line: 845

    This is because the filter completely replaces the original $args array. Two ways to deal with this…

    1) Quick n Dirty: append this to the child’s $args array –


    The empty strings are WordPress’ defaults, and may or may not match the actual runtime values (and you might not care, but you should).

    2) Probably more ‘proper’ and likely more future-proof is to merge our options into the inbound array using the WP core’s wp_parse_args(), thus:

    function childtheme_menu_args( $args ) {
    $my_args = array(
    'show_home' => 'Home',
    'sort_column' => 'menu_order',
    'menu_class' => 'menu',
    'echo' => false
    return wp_parse_args( $my_args, $args );
    add_filter('wp_page_menu_args','childtheme_menu_args', 20);

    which works for me, running PHP 5.2.6 + WP 3.0.2 + Thematic .9.7.7.

    And yes, the parameter order for wp_parse_args() is indeed counter-intuitive.


  9. thomas
    Posted June 25, 2011 at 16:35 | Permalink

    hi JeffM,
    great…that works….wp_parse_args() :-)!!


Post a Comment

Your email is never published nor shared.

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>