I have several custom post types on a WordPress theme I am developing. Each post type has a few custom taxonomies. I am using custom post types ui plugin. I have created a single post template for each custom post type. I am trying to add a custom in a certain location at the top to navigation between custom post types of that specific taxonomy only. So like if it were American Cars custom post type then the taxonomy was Make with ford, chevy etc I want to navigate between those. Where I am getting hung up is adding a class of active to the current post in my loop. Naturally the WordPress main menu gives you a class of active or current so you can style the current item, thats all I am trying to achieve. Here is one of the things I have tried and I just end up with a class of active on all items…
<div class="row">
<?php $temp = get_the_ID(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php $class = ( $temp == get_the_ID() ) ? 'active' : ''; ?>
<div class="large-10 columns large-offset-1">
<h2><?php the_title(); ?></h2>
<div class="large-8 columns slider">
<div class="models text-center">
start nav menu
<ul class="inline-list text-center">
<?php if( has_term( 'my-term', 'model' ) ) : ?>
<li><a href="<?php echo get_post_type_archive_link( 'my-archive' ); ?>">My Link:</a></li>
<li><a class="<?php echo $class ?>" href="<?php echo get_page_uri( '63' ); ?>">Taxonomy Item 1</a></li>
<li><a class="<?php echo $class ?>" href="<?php echo get_page_uri( '64' ); ?>">Taxonomy Item 2</a></li>
<?php else: ?>
other stuff here
<?php endif; ?>
</ul>
</div>
<div class="thumb-slider"><?php the_field('thumb_slider'); ?></div>
<div class="single-description"><?php the_field('single_description'); ?></div>
</div>
<div class="large-4 columns">
<div class="content">
<div class="spec-wrapper">
<h4>Specs</h4>
<?php the_field('specs'); ?>
</div>
</div>
</div>
</div>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
</div>