WordPress.org

Ready to get started?Download WordPress

Ideas

Add current-cat-ancestor class to categoly list

  1. Metusela
    Member

    By default the wp_list_pages function generates a great list of pages. One of the best things about this is that it gives each
    <li> appropriate classes, especially the current-page, current-page-parent and current-page-ancestor classes. As most of you probably know, this is great when it comes to styling my pages list (in other words, my menu).

    So, now I want to do the same thing with the category lists. Now it gives med the classes current-cat and current-cat-parent. But there is not a current-cat-ancestor class.

    As I've been searching around on the forums, ideas and documentation I found out that a function for finding out if a category is ancestor for the current category. I'm not too good at php-code (good enough to copy, paste and modify), so please help me. For now I'll be using an easy workaround (not displaying categories beyond level 2, at all).

    Posted: 4 years ago #
  2. cocktailbar
    Member

    12345

    This is a great idea. Just add the same functionality to categories.. If i had the current-cat-style, it would be very nice. thanks

    Posted: 4 years ago #
  3. This extensional functionality would be quite helpful for me. I would be glad, if this additional function would be added in one of the next WP-releases to organize my categories much smarter.

    Posted: 4 years ago #
  4. goldstrand
    Member

    Nice idea!

    Posted: 3 years ago #
  5. Good Idea, i think Drupal already implements these idea. Should be not so hard to adapt this to WP.
    Thanks.

    Posted: 3 years ago #
  6. mattcoxx
    Member

    I was looking to solve this probles on my website about sport, thanks a lot

    Posted: 3 years ago #
  7. Nicolas Chevallier
    Member

    12345

    Good idea. A lot of CMS already implement this.

    Posted: 3 years ago #
  8. IP PBX
    Member

    I have been worrying too much about this same problem, how ever I too failed to find a perfect solution for the problem. wp_list_pages generates a good list of pages, but with those functions around we would not be able to work out a solution by giving appropriate class for each. I have tried implementing it but as you have said I too have found the same piece of error " current-cat-ancestor class" . I'm also not that much good with PHP , I have some of my friends who are the masters of PHP I would soon let you have a PHP copy code posted here for you , which would solve the current-cat-ancestor class problem. I would soon let you know in here the code.

    Posted: 3 years ago #
  9. betclic
    Member

    I corrected this problem too on my blog, thanks

    Posted: 3 years ago #
  10. samjohn69
    Member

    if you need any help you can contact me Metusela.

    Posted: 3 years ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    15 Votes
  • Status

    This idea is under consideration