WordPress.org

Forums

Add class to top level menu items? (6 posts)

  1. FreeXenon
    Member
    Posted 5 years ago #

    I am quite a bit new at WP themeing. =(

    What is the best way to add a class to only the link for top level menu items?

    specific example:

    <li><a href="#" class="PopOutMenuTrigger">About Us</a>
                	<ul>
                        <li><a href="#">Schedule</a></li>
                        <li><a href="#">About BJJ</a></li>
                        <li><a href="#">Contact Us</a></li>
    		</ul>
    </li>

    A filter would be great, but whatever you can come up with...

    This class can be in addition to the normal classes created by WP.

    Thanks for whatever help you can give.

  2. marjiec
    Member
    Posted 5 years ago #

    To give a good answer it will be necessary to see the page.

  3. FreeXenon
    Member
    Posted 5 years ago #

    Here is the site: http://bjjwisconsin.freexenon.com

    Current nav code is hard coded.

    <ul id="navMain" class="BaseNavList PopOutMenu PopDown">
    
            	<li><a href="#" class="PopOutMenuTrigger">Home</a>
                	<ul>
                        <li><a href="#">Schedule</a></li>
                        <li><a href="#">About BJJ</a></li>
                        <li><a href="#">Contact Us</a></li>
    				</ul>
                </li>
            	<li><a href="#" class="PopOutMenuTrigger current_page_item">About Us</a>
                	<ul>
                        <li><a href="#">Schedule</a></li>
                        <li><a href="#">About BJJ</a></li>
                        <li><a href="#">Contact Us</a></li>
    				</ul>
              </li>
            	<li><a href="#" class="PopOutMenuTrigger">Schedule</a></li>
            	<li><a href="#" class="PopOutMenuTrigger">About BJJ</a></li>
            	<li><a href="#" class="PopOutMenuTrigger">Contact Us</a></li>
            	<li><a href="#" class="PopOutMenuTrigger">Media</a></li>
            </ul> <!-- end navMain-->

    Thanks for the response! =)

  4. FreeXenon
    Member
    Posted 5 years ago #

    BTW, I am a CRON'er too. I have been kind of working on it for a few years off and on, but more on. I eat about 1500 cal a day or so. I will have to bookmark your site. =)

  5. FreeXenon
    Member
    Posted 5 years ago #

    OK, so I have hard coded the navigation via PHP and it functions, but it is not going to be extensible by the site owners, and all changes to the navigation will have to be made by hand by me which is not cool.

    Anyone out there got a helping hand?

    Thanks

  6. marjiec
    Member
    Posted 5 years ago #

    There is another way I do links so clients don't have to code.
    I use the links section in the dashboard pasting in the url and picking a category.
    I then use a links widget.
    You can use several links widgets where ever you need them.
    A nice way to separate links.
    My clients like it this way too.

Topic Closed

This topic has been closed to new replies.

About this Topic