Title: [Plugin: WP Category Post List Widget] Highlight Active Post
Last modified: August 20, 2016

---

# [Plugin: WP Category Post List Widget] Highlight Active Post

 *  [JWSchaeffer](https://wordpress.org/support/users/jwschaeffer/)
 * (@jwschaeffer)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-category-post-list-widget-highlight-active-post/)
 * I want the active post to be highlighted within the WP Category Post List.
 * How do I make this happen?
 * [http://wordpress.org/extend/plugins/wp-category-posts-list/](http://wordpress.org/extend/plugins/wp-category-posts-list/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [flavigne](https://wordpress.org/support/users/flavigne/)
 * (@flavigne)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-wp-category-post-list-widget-highlight-active-post/#post-2909197)
 * I am wondering this too, I think it cannot be done right now. Still digging in
   the source code.
 *  [Kodiak](https://wordpress.org/support/users/pdboller/)
 * (@pdboller)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/plugin-wp-category-post-list-widget-highlight-active-post/#post-2909245)
 * I know this is an old post, but I was looking for this today and could not find
   a solution so I thought I’d post what I did. Please note: I am NOT a coder – 
   it took me a while to tweak the code to get to this point, and it may be wrong,
   but it works for me so it may work for others too.
 * Also, this probably removes some/all of the functionality of the widget options.
   I was working on a custom theme that the end user will not change, so this does
   not affect me.
 * **Use at your own risk!**
 * Here’s what I did.
 * In **/plugins/wp-category-posts-list/includes/wp_cpl_output_gen.php** look for_/**
   Initiate the post list widget HTML_. Replace:
 *     ```
       $default_class = ((true == $op['alternate_list_css'])? (($i%2 == 0)? 'wp-cpl wp-cpl-even' : 'wp-cpl wp-cpl-odd') : 'wp-cpl');
       ```
   
 * With:
 *     ```
       $current_url_1 = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
       if($current_url_1 == get_permalink($post->ID)) {
       $default_class = 'wp-cpl wp-cpl-current';
       } else {
       $default_class = ((true == $op['alternate_list_css'])? (($i%2 == 0)? 'wp-cpl wp-cpl-even' : 'wp-cpl wp-cpl-odd') : 'wp-cpl');
       }
       ```
   
 * (I basically replace the automatically generated default class with a new current/
   active class IF the specific link is the current one/same as the current URL).
 * After this, just add the class to your CSS file to give the current link a different
   style.
 * If anyone has a better option/solution, I’m always happy to learn something new!
   (
   Edit: tried to fix some formatting issues for this post)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘[Plugin: WP Category Post List Widget] Highlight Active Post’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-category-posts-list_edefec.svg)
 * [WP Category Post List Widget](https://wordpress.org/plugins/wp-category-posts-list/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-category-posts-list/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-category-posts-list/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-category-posts-list/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-category-posts-list/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-category-posts-list/reviews/)

## Tags

 * [active](https://wordpress.org/support/topic-tag/active/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 2 replies
 * 3 participants
 * Last reply from: [Kodiak](https://wordpress.org/support/users/pdboller/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/plugin-wp-category-post-list-widget-highlight-active-post/#post-2909245)
 * Status: not resolved