[Plugin: Query Posts] Tip: How to add active class with jQuery
-
Hi!
I was lacking an active class for the selected post in the widgets list so I made this little script to add it retrospectively.
Append this jQuery-script to the end of your single.php:
<!-- Add active class to Query Posts list --> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function() { jQuery('.posts .post-<?php the_ID(); ?>').addClass('active'); }); </script>
Then add this to your CSS (example):
.widget-container.posts div.active a {
font-weight: bold;
}Check this out if you don’t know how to include jQuery the right way in WP.
- The topic ‘[Plugin: Query Posts] Tip: How to add active class with jQuery’ is closed to new replies.