So I was trying to loop all the post from wordpress with the_excerpt. Then I was stuck on how to get and pass the data from a single post by clicking a link or button to appear the_content() on a modal div.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post">
<h2><?php the_title(); ?></h2>
<p><?php the_time('F jS, Y'); ?> by <?php the_author(); ?></p>
<div class="blog-content">
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; else : ?>
<p><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></p>
this is how my modal look like..
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<!-- the_content() in here-->
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
not sure this will work
<button class="btn btn-primary tag_cnt" onclick="showModal('data')" type="button" value="<?php $post->post_content;?>"></button>
then use a function like this
function showModal(data)
{
$("#myModal .modal-body").html(data)
$("#myModal").modal();
}
but how do i transfer multiple values like the_content and the_title?