Im trying to use bootstrap tabs to have a tab system following:
Each tab has the_title (post title), on click of each tab, display the content.
So far, I have all the tab listed correctly, and the first one appear with the good content. However, on Click to another tab, the content doesn't change to show the one it should.
I suppose I need to give a class postID for that and link the Href to this same class post ID.
Below is the code im trying to make work - unsuccessfully :(:
<?php get_header(); ?> <div class="container "> <div id="tab"> <ul class="nav nav-tabs" role="tablist"> <?php $loop = new WP_Query( array( 'post_type' => 'candidates', 'posts_per_page' => -1 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <li role="presentation" class="post-<?php the_ID(); ?>"><a href="#post-<?php the_ID(); ?>" aria-controls="home" role="tab" data-toggle="tab"><?php the_title();?></a></li> <?php endwhile; wp_reset_query(); ?> </ul> <div class="tab-content"> <div role="tabpanel" class="tab-pane active" id="post-<?php the_ID(); ?>"><?php the_content();?></div> </div> </div>
Any help would be awesome :) :)
Thank you guys !