I have a custom post type, "case". I'm currently editing the single-case.php file and in my sidebar I have the following piece of code:
<?php
$case_query = array (
'post_type' => 'case',
'showposts' => -1,
'orderby' => 'title',
'order' => ASC
);
query_posts($case_query);
if ( have_posts() ) {
echo '<div class="case-list">';
while (have_posts()) {
the_post();
$title = get_the_title();
$url = get_permalink(); ?>
<div class="case-list-item">
<div class="ico"><i class="fa fa-fw fa-angle-right"></i></div>
<div class="link"><a href="<?php echo $url; ?>"><?php echo $title; ?></a></div>
</div>
<?php
}
echo '</div>';
wp_reset_query();
}
?>
What I'm wondering is, how do I check which of the posts in above while-loop is the currently viewed post and then add a class of "current" to it? Or am I doing this all kinds of wrong?..