Highlight current Custom Taxonomy and Custom Post Type
-
I want to highlight the current post that is being displayed.
I have created a custom post_type: Evaluations
Within the custom post_type, I have several custom categories.
I use this code to display the custom post under the category/slug: evaluations
<h2>ARCHIVED EVALUATIONS</h2> <ul> <?php $args=array( 'post_type' => 'evaluations', 'cat' => '32', 'showposts' => -1, ); query_posts($args); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <li<?php if ( $post->ID == $wp_query->post->ID ) { echo ' class="current"'; } else {} ?>> <a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> <?php endif; ?> </ul>
Now, when a user clicks on one of the post, it should display it in the single_evaluation.php template. Whn being displayed, the post should be assigned the “class=current”, and to have the link be highlighted and the others not.
Instead, I get all the links highlighted, because “class=current” has been assigned to all.
any help will be appreciated!
- The topic ‘Highlight current Custom Taxonomy and Custom Post Type’ is closed to new replies.