WordPress specific category post content open in a bootstrap modal

Question

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

<ul>
<?php while($catquery->have_posts()) : $catquery->the_post(); ?>
<li><h3>
<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>
      <div class="modal-body">
<ul><li><?php the_content(); ?></li>
</ul>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>
</li>
<?php endwhile; ?> 
</ul>
<?php wp_reset_postdata(); ?>   

But this repeating the first result only.

0
VKS 8 months 2020-12-09T01:10:19-05:00 0 Answers 5 views 0

Leave an answer

Browse
Browse