WordPress specific category post content open in a bootstrap modal


WordPress display posts from specific category on page and click the link must show the content in a bootstrap modal.

<?php while($catquery->have_posts()) : $catquery->the_post(); ?>
<a data-toggle="modal" data-target="#myModal"><?php the_title(); ?></a></h3>
<div id="myModal" class="modal" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title"><?php the_title(); ?></h4>
      <div class="modal-body">
<ul><li><?php the_content(); ?></li>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

<?php endwhile; ?> 
<?php wp_reset_postdata(); ?>   

But this repeating the first result only.

VKS 2 months 0 Answers 5 views 0

Leave an answer