0
votes

I cannot figure out how to use the wp_list_categories function to do what I need it to:

<?php if(is_category() or is_page('realisations') or is_single()) { ?>
<ul id="subpage">
    <?php wp_list_categories('child_of=3&title_li=<h4>Les secteurs</h4>'); ?>
</ul>
<?php }; ?>

I have it set up so that all of the project categories are child categories of the a main category (child_of=3) This is to avoid conflicts with the news section of the site.

The problem is that I need the category the post is in to highlight when viewing the single.php page template, but I don't know how to accomplish that. When on a category page the category view highlights correctly because I styled the class that WordPress adds into the generated list .current-cat.

1
Remember that there is a Wordpress Stack Exchange site, that might be more specifically useful to your question. (This doesn't constitute a vote to close, just advice.)David says reinstate Monica

1 Answers

0
votes

I answered my own question! This wonderful plugin has the function that I didn't need to write myself: http://www.screenshine.net/blog/1474_wordpress-plugin-show-active-category

It sets a filter to add into the wp_list_categories() function, the only thing I dislike about it is that it sets a css class on the anchor instead of the list item, which is inconsistent with WordPress functionality. It works in a pinch though, which is what I am in. You can stick it in your functions.php to prepackage the plugin and do minor edits.