Support » Fixing WordPress » Check for parent category in sidebar

  • I have a menulist with link to a category Articles on my website (and some other links to categories).

    When entering Articles from the menulist, the link get black to indicate where you are. Also, a list of subcategories appear in the sidebar (subjects like webdesign, php etc). I have accomplished this with
    is_category(‘Articles’)

    Now to the problem – when you click a subcategory for ‘Articles’ – like ‘Webdesign’ – the is_category(‘Articles’) is not true any more, and the list of subcategories in the sidebar disapear and the Articles-link in the menulink become blue again.

    How do I check that the visitor is still in the Articles-category when they navigate down to subcategories? Is it possible in any other way then making a lot of conditions like

    if (is_category(‘Articles’) || is_category(‘Webbdesig’) (and so on)

    Thanks for any help. Hope I have translated everything correct, I’m from sweden so english is not my language 😉

    / Mattias

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am afraid that is the only way: using a lot of conditionals (if statements).

    Ok, thanks moshu 🙂

    Its not that many subcategories so I guess it could work anyway. But it would been nice with an easier solution. Maybe a task for a new plugin – perhaps I will try to create one some day 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check for parent category in sidebar’ is closed to new replies.