WordPress.org

Ready to get started?Download WordPress

Forums

Add style to a single menu nav element (2 posts)

  1. RobotBash
    Member
    Posted 10 months ago #

    Hi, I have the following in the my wordpress header.php:

    <?php if ( is_user_logged_in() == false) {
    	wp_nav_menu( array( 'menu'=>'Logged-Out Menu', 'container_class' => 'menu-header', 'theme_location' => 'main-menu' ) );
    } else {
    	wp_nav_menu( array( 'menu'=>'Logged-In Menu', 'container_class' => 'menu-header', 'theme_location' => 'main-menu' ) );
    	} ?>

    The Logged-In menu has an account page link. I want to wrap a div around the account page link so I can style it with CSS. Haven't had any luck so far, is their a simple solution to this that I can add in the header.php?

    Thanks!

  2. RobotBash
    Member
    Posted 10 months ago #

    Ok, so I've been looking into this and it seems wp_nav_menu() and or wp_nav_menu_items might be what I need to manipulate to get the desired effect, i.e. To change the color of the last 'Logged-In Menu' item which is a link titled 'My Account'.

    Problem is I'm not sure these are the correct functions I need, and if so, I don't know where to start to get the output I want.

    So I think I need to:

    1. Identify the list item by title.
    2. Wrap it with a div that has an id for css styling.
    3. Output the menu.
    4. Style with CSS to change the color.

    Could anyone point me in the right direction with this please?!

Reply

You must log in to post.

About this Topic