ThemeShaper Forums » Thematic

[closed]

Custom Menu with Drop Down?

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

    I wanted to add an external link button to the menu and so I've created a custom menu using the following in my child theme. 'Store' is the external link. You can have a look here at http://www.crossbirdproject.com.


    <?php
    function childtheme_menu() { ?>
    <div id="menu-primary" class="menu">
    <ul class="sf-menu sf-js-enabled">
    <li class="<?php if ( is_page('home') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>">/">Home
    <li class="<?php if ( is_page('products') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>">/products" >Products
    <li class="<?php if ( is_page('blog') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>">/blog">Blog
    <li class="<?php if ( is_page('about') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>">/about">About
    <li class="<?php if ( is_page('store') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><span>Store</span>

    </div>

    <?php }

    add_action( 'wp_page_menu', 'childtheme_menu' );

    Now this is all fine and looking good except now my drop down menu under 'Products' isn't working. It was working fine when it's not a custom menu.

    I'm new to this so any help is much appreciated!

    Posted 3 years ago #
  2. why not use wp 3.0's new menu feature? the code to implement it is pretty easy:

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

    but you don't have any sub-menus, so you can't have any drop downs.

    <li class="<?php if ( is_page('products') ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="/products">Products</a>
    <ul>
    <li>Sub Item 1</li>
    <li>Sub Item 2</li>
    <li>Sub Item 3</li>
    </ul>
    </li>
    Posted 3 years ago #
  3. felixthecat2
    Member

    Cool, thanks! I successfully switched to using the WP 3.0 menu, but I want my 'Store' button to have diiffernt CSS styling then the rest. Any clue how this is achievable?

    Posted 3 years ago #
  4. well that li element has a unique id as seen in the source code (or viewed w/ firebug)

    so you could

    #menu-item-65 {} and/or #menu-item-65 a{} to target that link specifically.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.