• I found this code (thank you!) in this thread for highlighting the current post in a category list.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Can anyone help me adapt this for use with highting the current post from a custom post type list. This is what I have in my sidebar.

    <?php
      query_posts( array( 'post_type' => 'events') );
      if ( have_posts() ) : while ( have_posts() ) : the_post();
    ?>
      <li>
         <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      </li>
    
    <?php endwhile; endif; wp_reset_query(); ?>

    I need <li class='current'> when on the single post page.

The topic ‘Highlight current post from custom post type in sidebar’ is closed to new replies.