Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6639945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:36:54+00:00 2026-05-25T23:36:54+00:00

I have a WordPress site where I’m trying to solve a very simple problem.

  • 0

I have a WordPress site where I’m trying to solve a very simple problem. I have a primary menu at the top and a secondary menu at the left side. The top menu contains level 1 items while the left menu has all the items. For the left menu I am using the built-in “Custom menu” widget.

To simplify the looks I would like to only show the items on the left which are relevant to the current area, namely items with current-menu-ancestor.

  1. Is there any way to do it elegantly, by generating only the needed code in HTML? Either by using some custom function in functions.php (I’m using a Twenty Eleven child theme), or by some “Advanced Custom Menu” plugin if there is such?

  2. I am trying to do it in CSS, and I’m almost there. I selected the items green what I like to keep and red what I would like to hide, but I cannot apply a CSS rule to display: none the red items, because then it hides the green items too.

My CSS so far is this:

#secondary ul {background: red;}

#secondary li.current-menu-ancestor ul,
#secondary li.current-menu-item ul {background: green;}

Here is a sample page where you can see which are the red items I’m trying to hide and which are the green items I’m trying to keep.

http://kozossegikertek.hu/csatlakozz/

I would like to have only the green items visible on the left menu.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:36:54+00:00Added an answer on May 25, 2026 at 11:36 pm

    OK, I did the pure CSS solution. I’m still up for a WP specific solution if someone can do it:

    #secondary li a {
    display: none;
    }
    
    #secondary li.current-menu-item ul a,
    #secondary li.current-menu-ancestor ul a {
    display: inherit;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wordpress site, and in the home page , there is side
I have a problem with a WordPress site that is not reading the meta
I have a simple RSS feed coming in my Wordpress site with php, but
I have a wordpress site with a basic CSS dropdown menu, and seems the
I have a horizontal menu for wordpress site and the menu items are categories.
I want to have a top border on my wordpress site like this: Thanks!
I have created a wordpress site. The home page appears in the navigation menu
I have a WordPress site (2.6.2) in which I have set the Home page
I have a wordpress site with 5k post and each post has average 25
I have to upgrade a running wordpress site's wordpress CMS and some installed plugins.and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.