ThemeShaper Forums » Thematic


Adding 'page name' id to menu li's

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

    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() {
    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' ); ?>
    		<!-- #access -->
    	<?php }

    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 10 years ago #
  2. I believe if you have the latest release of Thematic ( 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 10 years ago #
  3. dr_tchock

    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 10 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 10 years ago #
  5. dr_tchock

    Gah, nevermind then. Thanks for your help!

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.