ThemeShaper Forums » Thematic

[closed]

JQuery Menu Accordion in Thematic

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

    Hello!

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

    http://www.i-marco.nl/weblog/jquery-accordion-3/

    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 3 years ago #
  2. Chris shows how to do this with a preg-replace: http://programming.thematic4you.com/2010/03/how-to-test-wp_nav_menu-with-thematic/

    I just rebuild the action rather than filtering it:

    // Remove #access
    
    function remove_thematic_actions() {
    		remove_action('thematic_header','thematic_access',9);
    	}
    
    add_action('init','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' ); ?>
    		</div>
    		<!-- #access -->
    	<?php }
    add_action('thematic_header','childtheme_menu',9);

    Posted the code on my site: http://wptheming.com/2010/03/using-3-0-menu-navigation-with-thematic/

    Posted 3 years ago #
  3. tradiArt
    Member

    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 3 years ago #
  4. tradiArt
    Member

    Solution here:

    http://themeshaper.com/guide-customizing-thematic-theme-framework/

    // Filter away the default scripts loaded with Thematic
    function childtheme_head_scripts() {
        // Abscence makes the heart grow fonder
    }
    add_filter('thematic_head_scripts','childtheme_head_scripts');

    Solved :-)
    Once again, thank you.

    Posted 3 years ago #
  5. Hi,

    Heads up using add_theme_support in this way is not advised

    ref: http://forums.themeshaper.com/topic/add_theme_supportmenus

    -Gene

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.