ThemeShaper Forums » Thematic

[closed]

How to get non-selectable top menu items when there is a sub-menu

(11 posts)
  • Started 4 years ago by Jacques
  • Latest reply from em hr
  • This topic is not resolved
  1. Jacques
    Member

    Hello,

    When a menu item has a sub-menu, I would like the top item to be non-selectable, i.e. I want no page corresponding to the top item, only the sub-menu.

    E.g. in the menu:

    Durations
    Colors
    - Red
    - Blue
    - Green
    Sounds
    Persons

    I want pages (and therefore selectable menu items) for Durations, Red, Blue, Green, Sounds, and Persons, but not for Colors.

    Any idea how I should go about this? Thanks.

    Posted 4 years ago #
  2. You could use the new menu function, and create dummy links for those items. (e.g. the link is href="#").

    See this thread in the forum: http://forums.themeshaper.com/topic/a-better-way-to-use-the-new-menu-in-wordpress-30-final-version#post-13219

    Or I have a post on my site: http://wptheming.com/2010/03/using-3-0-menu-navigation-with-thematic/

    Posted 4 years ago #
  3. Jacques
    Member

    Thanks a lot. That seems a bit complicated for my current level of familiarity (actually it seems simple, but since I wouldn't know what I'm doing, I don't think I will take the risk). For now I will deal with the present situation and then when a stable release made for the WP3 menus is published I'll move to that. Thanks again.

    Posted 4 years ago #
  4. i don't mean to be a jerk, but it doesn't get much simpler than gene's code snippet in that first link. if you don't know what you are doing, the best way to learn is by using tested code snippets, like Gene's. this may be too much, but here is another very complete resource on 3.0 menus.

    http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

    wordpress 3.0 is final and many people are implementing those menus in with thematic w/ no problem (myself included). from what i understand, thematic is not going to make that the default as it would break child themes built on the old thematic.

    Posted 4 years ago #
  5. Jacques
    Member

    No problem helgatheviking, thanks for insisting and providing more perspective and your link (I will read it for sure!).

    Posted 4 years ago #
  6. Jacques
    Member

    Following helgatheviking's advice, and after figuring out that "Gene" was the poster called "em hr", I've put

    add_theme_support( 'menus' );

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

    in functions.php.

    I can create a menu in WP3, but apparently something else is necessary to tell thematic to use it instead of the current one automatically built out of my pages?

    In the top left corner of the menu panel in the backend, it says that my theme can use 0 menu...

    Posted 4 years ago #
  7. Jacques
    Member

    PS: I've tried to use the code tags for the code snippet but only the first line appears as code.

    Posted 4 years ago #
  8. Jacques
    Member

    Ah, I used

    add_action( 'init', 'register_my_menu' );

    function register_my_menu() {
    register_nav_menu( 'primary-menu', __( 'Primary Menu' ) );
    }

    and now the theme locations box in the back end allows me to select my newly created menu. The menu still doesn't appear on the website though.

    Posted 4 years ago #
  9. oops sorry. 'gene' is indeed 'em_hr'. any time you see a post by him you should pay attention b/c you will probably learn something cool.

    are you still having issues w/ this? on my local install i just dropped in a gene's snippet to a new theme i am working on and it works fine. the menus panel says my theme supports 0 menus, but w/ this snippet thematic should (does for me) automatically replace the pages menu w/ the first custom menu. do you have more than 1 menu created in WP?

    and to post code you type it between 2 backwards tick marks `

    Posted 4 years ago #
  10. Jacques
    Member

    Yes, it still doesn't work. With a new child theme with style.css having the basic series of import statements and functions.php being precisely:

    <?php
    
    // Use WP3 menu
    add_theme_support( 'menus' );
    function child_access_menu() {
    	$menu_sys = 'wp_nav_menu';
    	return $menu_sys;
    }
    add_filter('thematic_menu_type', 'child_access_menu');
    
    ?>

    I can create a menu in the backend, it says my theme can use 0, and when I create it (only one) my website still shows the menu built out of the top pages.

    Posted 4 years ago #
  11. Hi,

    Sorry for the misinformation but using add_theme_support in this way is not advised

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

    -Gene

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.