very similar approach to the answer by @AndrettiMilas:
add_filter('wp_list_categories','style_current_cat_single_post');
// filter to add the .current-cat class to categories list in single post
function style_current_cat_single_post($output) {
if( is_single() ) :
global $post;
foreach ( get_the_category($post->ID) as $cat ) {
$cats[] = $cat->term_id;
}
foreach($cats as $value) {
if(preg_match('#item-' . $value . '">#', $output)) {
$output = str_replace('item-' . $value . '">', 'item-' . $value . ' current-cat">', $output);
}
}
endif;
return $output;
}
adapted from one of my articles.
Related Posts:
- How to create a custom sort for WordPress categories
- Hook when category is added to post
- get_categories for custom post type with a specific custom taxonomy attached
- How to add the category ID to admin page
- Multiple Domain Names – One WP Install (non-Multisite) – Default Each Domain name to Category Archive
- Exclude categories from Loop, queries, widgets, post navigation
- Filter categories using tags
- Sticky posts on home page, search, tag and archives without plugin
- WordPress 1 domain multiple blogs
- Show Post from parent category (custom taxonomy) ONLY!
- How to display a list of categories
- One WordPress Install, Two Categories. Each Category Gets a Domain
- Name of last category level for a post
- How to add style to category link?
- WordPress Ordering Problem. How to fix ordering 1-10-100 issue?
- is_category in pre_get_posts results in php notices
- Filtering Children of the “uncategorized” Category out of the Loop?
- How do I get the total number of categories in a list of search results?
- Update wordpress post terms programatically
- Filtering search results
- Display products for a category, sorted by post_excerpt
- Creating archive pages for children categories
- “NOT ONLY IN” taxonomy query operator?
- How do you bulk remove a category from posts?
- How to remove the “+Add Category” button from the Category metabox?
- Show recent posts from one category on a non-WP site
- Multiple Category Search
- Omit specific product categories from WooCommerce shortcode
- Category-slug.php not being used
- Pagination for category slug returns 404 when page >= 2
- Display category-specific comments in sidebar
- I want to display posts common in 3 categories [closed]
- Displaying just one new/current post per category in homepage
- Paging not working in category.php
- How do I share categories across selected sites in a Multisite setup
- Show popular post by category code
- Display list of categories filtered by date?
- Drop posts from categories in MySql
- Equivalent to in_category() for subcategories
- query_post order desc
- Exclude category by slug in pre_get_posts?
- list categories based on updated posts [closed]
- add slug beside name in Admin Category Checklists
- How to show 5 posts from specific category on related page?
- How can I only display one link rather than many?
- Hierarchical permalink structure for posts showing categories and sub-categories
- Exclude category from related post
- Post belonging to many categories
- how do I use the walker class to display categories in their correct heirarchy?
- How can you access category information from a theme?
- Filter WooCommerce archive pages by an additional category
- WP 4.7 in_category change?
- display category list year wise in wordpress
- Echo show_count of categories separately without using wp_list_categories
- Display subcategories in dropdown
- Illegal string offset ‘taxonomy’ in
- Category Page Template – Can’t get category ID
- Are term_taxonomy_id and term_id the same? [duplicate]
- Display all sub category but one
- Let user select their own category
- Filter Category Loop Dynamically
- SQL query to get posts from multiple categories but not in a category
- Can each user have only access to a private area (his own categories and posts)?
- Pagination breaks on child-categories, works fine on parent-category
- WP Category Meta plugin fix? [closed]
- WP SQL Categories Export and Import
- Category name for all posts getting assigned to a single random post
- How to display WooCommerce category image in my category page banner as a background?
- Why are my newly added categories not showing up when creating a post?
- WordPress Default Category and Custom Taxonomy Selected Attribute not Working After Searched in wp_dropdown_categories Array
- How to add the .html extension to the category?
- Order wp_dropdown_categories by ASC or DESC
- Add filter for specific category only
- How to create category filter on a blog like on the site below?
- How to exclude a category returned by get_categories from function.php?
- Displaying only selected categories
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- Getting a sub category based on a category name
- How to display only sticky posts on category pages?
- Conditional statement: if is_category, append at the end of page
- How to Manage and link certain custom taxonomy?
- Store All Post Categories In Array
- How to add an “All” category to the tag cloud?
- I have many different products on my website how can I get them to display under specific categories?
- Help with SQL query, how to add taxonomie terms with value stored in options?
- /blog/ permalink prefix causes category pages to 404
- How to create an array with category ids order by the one that has the most recent post
- WP url to get rss with full text of post
- Display Referring Category on single post?
- Conditional statements based on custom meta value in category archives
- Placement of categories
- Categories Going to different Blog Pages?
- Display deepest post category, when post have multiple categories
- Paginate WordPress Category Pages
- Get a list of post titles and links from yootheme master theme
- How to structure Multisite sites into categories?
- Template files not working for archives and categories
- Excluding cateory not working on my site. how to solve this? [closed]
- Get all first images of posts in same category
- What defines a post as portfolio page content?