Hey universaltruth,
Thanks for posting!
I played around with this a bit, adding some sample ‘fruit’ and ‘vegetable’ categories and posts. There are a number of ways to implement the menu, and the solution will depend on a number of things in your site.
Ultimately, I would look into the body_class()
function, for possibly adding the ‘category’ class to the body tag. There may be some custom coding needed, including php, css and javascript, but you probably just want to ‘hide’ the children of the non-current-category.
Also, could I get a piece of clarification? Will the ‘children’ in the menu be child categories or child posts? The solution may depend on the implementation.
Does this help you get started? If you could reply back with a sample link and the name of your theme, I may be able to help you more.
Hope this helps. Cheers!
Here is an example of the body_class function showing the category of a category page.
https://codex.wordpress.org/Function_Reference/body_class
View post on imgur.com