ThemeShaper Forums » Thematic

[closed]

Adding 'page name' id to menu li's

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

    Just trying out Thematic, is really great so far. I'd like to add a more useful id to the li's in the access menu - I need the page title in there for CSS reasons. I've used the following (courtesy of Devin) to utilise the WP3.0 menus:

    function remove_thematic_actions() {
    		remove_action('thematic_header','thematic_access',9);
    	}
    
    add_action('init','remove_thematic_actions');
    
    if ( function_exists( 'add_theme_support' ) ) {
    
    	// This theme uses wp_nav_menu()
    	add_theme_support( 'nav-menus' );
    
    }
    
    function childtheme_menu() { ?>
    
    	<div id="access">
      			<?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);

    There's doesn't appearo to be any params passed into wp_nav_menu that will help me to do what I want. Any ideas? I'd prefer to avoid hard-coding the menu's if possible.

    Apologies if this has been asked before, I couldn't find an answer

    Posted 3 years ago #
  2. I believe if you have the latest release of Thematic (0.9.7.7 I believe) WP 3.0 menus are supported by default so no need for that function.

    If you decide to use a custom menu it will generate a custom id for each menu element so you can style them individually. It doesn't include the page/post name though. They look like this: #menu-item-1, #menu-item-2, etc...

    Why do you need the name in there specifically?

    Posted 3 years ago #
  3. dr_tchock
    Member

    Didn't realise that about the WP3.0 menus, will revert back.

    I need to use an image for each button and would prefer to target them by page name than the somewhat obscure id's that are generated automatically.

    Posted 3 years ago #
  4. I know it's a pain but in my opinion it's much easier than hacking the WordPress core files ;)

    Funny coincidence is when I wrote my first answer I was doing exactly that, replacing the menu with images.

    It's not that bad... I have it set like this (using CSS sprites)


    #menu-item-86 a { background: url(images/menu/home.png) }
    #menu-item-86 a:hover { background: url(images/menu/home.png) 100px }

    Posted 3 years ago #
  5. dr_tchock
    Member

    Gah, nevermind then. Thanks for your help!

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.