Add “current” class to sidebar item
-
Hello,
I would like to add a class “current” as in wp_list_pages() in my sidebar. However my sidebar is something like this:<div id="sidebar"> <ul id="menu-1"> <li class="title"><a>Presentación</a> <?php query_posts('category_name=presentacion'); if ( have_posts() ) : ?> <ul> <?php while ( have_posts() ) : the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; endif; ?> <?php wp_reset_query(); ?> </ul> </li> </ul> </div>
and my question is how can I add e.g. class=”current” to either or when the URL matches the permalink.
To put this another way: I would like to show the visitor what post he is viewing in the sidebar by changing the style.
Any help will be appreciated.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add “current” class to sidebar item’ is closed to new replies.