• Resolved thenut

    (@thenut)


    Hi, I will try to explain what I need / wish for / trying to hack :):
    I am using WP as a CMS. Already built everything (used plug ins for languages etc’). Now, on my sidebar, I list all -children of main category :

    – Main category (Tech Help) (Not showing on side bar)

    (This is what I show on sidebar) :

    — installation

    — Tech Notes

    —Tech notes for X
    —Tech notes for Y

    and then under those categories, admin will use posts.
    Everything works great, when I am on a category page, I can see the hierarchy through the “wp_list_categories” function provide. The only problem, WP doesn’t recognize posts with categories, therefore, when navigating to a post under a certain category, the indication where we are is gone. Since the function “wp_list_categories” doesn’t recognize this page or the category parent of this post as one. Now I know it has to do with the fact that you can have multiply categories for a single post and that could be a problem, but in this case, there could be only one category to each post. I am trying to figure out a way where I can hack the “wp_list_categories” function to add the li ul class even if I an on a post page, maybe by sending the parent category of the post as an argument to this function, but this looks too complicated. Any other ideas?

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter thenut

    (@thenut)

    If any one is interested:
    I have found the sulotion. I hacked the wp_list_categories to get another argument and on line 246 I added :

    if (is_single())
    $r[‘current_category’] = $cat;

    where $cat is the seconed arg this function gets.
    Tada.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_list_categories and Post’ is closed to new replies.