ThemeShaper Forums » Thematic

[closed]

Completely remove drop down menu from horizontal menu

(5 posts)
  • Started 4 years ago by amberlaine
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. amberlaine
    Member

    Hi y'all,

    I need to completely remove the functionality that allows the subpages to appear as drop down items form the horizontal menu at the top of the theme.

    I have seen some suggestions on how to display:none it with CSS; this isn't gonna work for me. I need to completely disable the drop downs.

    Help?

    Posted 4 years ago #
  2. Hi,

    take a look at this thread: Removing the drop down menu using filtering?.

    Chris

    Posted 4 years ago #
  3. Hi, I'd been looking for the answer to this for a while as well. I found that you can add a single line of code to the commented out function in the function.php file that is supplied for the child theme:

    'depth' => '1',

    The code will then look like this:


    function childtheme_menu_args($args) {
    $args = array(
    //The depth argument disables the dropdowns and only passes the top level.
    'depth' => '1',
    'show_home' => 'Home',
    'sort_column' => 'menu_order',
    'menu_class' => 'menu',
    'echo' => true
    );
    return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');

    If you don't actually want to include the home link, you can just delete the line

    'show_home' => 'Home',

    The depth set at 1 will only show the top level navigation.

    Hope that helps...

    -Alex-

    Posted 4 years ago #
  4. peterkz
    Member

    Is alturnwall's suggestion above still valid for Wordpress 3.1? Nothing happens when I add it to my child themes functions.php. Also, http://codex.wordpress.org/Template_Tags/wp_page_menu does not list depth as a parameter.

    Posted 3 years ago #
  5. no it isn't 100% accurate but it isn't totally wrong either. almost everything menu related is covered at :
    http://forums.themeshaper.com/topic/thematic-menus-demystified-1

    but the depth param still works for me. depending on your version of thematic you might need to add a priority to the add_filter function. i have the latest stable dev release :
    http://developing.thematic4you.com/thematic-development-release/

    just tested:

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

    which doesn't seem to need the priority (the number 20) any more- so gene must have fixed whatever was causing that bug he mentioned in the menus mega thread. but you might need if if you have an older version.

    of course, this ONLY works if you have not assigned a menu to the Primary menu location.... as thematic will THEN use the page menu whose params you've just filtered. these params are NOT for 3.0-style menus. for that please see the referenced menu thread.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.