ThemeShaper Forums » Thematic


JQuery Menu Accordion in Thematic

(5 posts)
  • Started 10 years ago by tradiArt
  • Latest reply from em hr
  • This topic is resolved
  1. tradiArt


    I need to implement this menu in a WP3 site with Thematic:

    What I really want is not to change anything in the thematic framework files so I suppose I must:

    1. Let my child theme to use the wp_nav_menu from my own functions.php file:

    add_theme_support( 'menus' );
    function child_access_menu() {
    	$menu_sys = 'wp_nav_menu';
    	return $menu_sys;
    add_filter('thematic_menu_type', 'child_access_menu');

    2. Add CSS code to CSS file.

    3. Call the JS file from my functions.php file of my custom thematic child theme:

    function load_my_menu() {
    	if ( !is_admin() )  // instruction to only load if it is not the admin area
    		wp_enqueue_script( 'menu', get_stylesheet_directory_uri() . '/js/menu.js', false, 0.1 );
    add_action( 'template_redirect', 'load_my_menu' );

    4. Change/add to the generated html markup the needed classes and here is where I'm lost. I can change some lines of code in header-extensions.php file, but I don't want my menu stop working when a upgrade it's done.

    How can I change/add the needed classes?

    4a. Change <ul class="sf-menu"> to <ul class="menu">.
    4b. <ul class="acitem"> in secondary level.

    Thank you very much for your assistance! :-)

    Posted 10 years ago #
  2. Chris shows how to do this with a preg-replace:

    I just rebuild the action rather than filtering it:

    // Remove #access
    function remove_thematic_actions() {
    // Enable WordPress 3.0 Menus
    if ( function_exists( 'add_theme_support' ) ) {
    	// This theme uses wp_nav_menu()
    	add_theme_support( 'menus' );
    // Rebuild #access with new classes and args
    function childtheme_menu() { ?>
    	<div id="access">
      		<div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>">
        	<?php _e('Skip to content', 'thematic'); ?></a></div>
      			<?php wp_nav_menu( 'sort_column=menu_order&container_class=menu&menu_class=sf-menu' ); ?>
    		<!-- #access -->
    	<?php }

    Posted the code on my site:

    Posted 10 years ago #
  3. tradiArt

    Thank you!!!

    This is exactly what I was looking for... :-)

    After implementation seems there is a conflict between menu.js and the "thematic-dropdowns.js" file which is called in line 325 of "header-extensions.php":

    $dropdown_options = $scriptdir_start . 'thematic-dropdowns.js' . $scriptdir_end . "\n";

    How can I remove the call to "thematic-dropdowns.js" from my own functions.php file?

    Thank you again!

    Posted 10 years ago #
  4. tradiArt

    Solution here:

    // Filter away the default scripts loaded with Thematic
    function childtheme_head_scripts() {
        // Abscence makes the heart grow fonder

    Solved :-)
    Once again, thank you.

    Posted 10 years ago #
  5. Hi,

    Heads up using add_theme_support in this way is not advised



    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.