ThemeShaper Forums » Thematic

[closed]

change thematic_page_menu_args

(4 posts)
  • Started 3 years ago by cas
  • Latest reply from handsofaten
  • This topic is resolved
  1. In the latest (0.9.7.6) version of Thematic - How do I override the arguments for thematic_page_menu_args in my child theme? Basically, I want to take this out of the header-extensions.php file:

    // Create the default arguments for wp_page_menu()
    
    function thematic_page_menu_args() {
    
    	$args = array (
    
    		'sort_column' => 'menu_order',
    
    		'menu_class'  => 'menu',
    
    		'include'     => '',
    
    		'exclude'     => '',
    
    		'echo'        => FALSE,
    
    		'show_home'   => FALSE,
    
    		'link_before' => '',
    
    		'link_after'  => ''
    
    	);
    
    	return $args;
    
    }
    
    add_filter('wp_page_menu_args','thematic_page_menu_args');

    and change it to this:

    // Create the default arguments for wp_page_menu()
    
    function thematic_page_menu_args() {
    
    	$args = array (
    
    		'sort_column' => 'menu_order',
    
    		'menu_class'  => 'menu',
    
    		'include'     => '',
    
    		'exclude'     => '3,2,411,408,371,9,398,4,276,14,270,272,212,5,246,450',
    
    		'echo'        => FALSE,
    
    		'show_home'   => FALSE,
    
    		'link_before' => '<span></span>',
    
    		'link_after'  => ''
    
    	);
    
    	return $args;
    
    }
    
    add_filter('wp_page_menu_args','thematic_page_menu_args');

    I've tried doing this in my child-theme's functions file:

    function childtheme_menu_args($args) {
        $args = array(
            'exclude' => '3,2,411,408,371,9,398,4,276,14,270,272,212,5,246,450',
            'link_before' => '<span></span>',
        );
    	return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    and changing my wp_page_menu call to the new echo as described here: http://developing.thematic4you.com/2010/04/breaking-things-to-fix-others/

    ...but no joy. What am I doing wrong?

    Posted 3 years ago #
  2. Yup - Figured it out - I had to change the priority to 11 on MY function - as otherwise the parent is defaulting to 10 and since it's being called later, takes priority.

    function childtheme_menu_args($args) {
        $args = array(
            'exclude' => '3,2,411,408,371,9,398,4,276,14,270,272,212,5,246,450',
            'link_before' => '<span></span>',
        );
    	return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args', 11);
    Posted 3 years ago #
  3. Christos
    Member

    Hey! That worked for me too!
    (I've change the priority to 11 on MY function)

    Posted 3 years ago #
  4. handsofaten
    Member

    The priority suggested by cas works, but it strips off the sf-menu class and thus the default menu styling. Is there a better way?

    EDIT Nevermind, I had echo => true, and changing it to priority > 10 along with echo => false fixed it.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.