Answer the question
In order to leave comments, you need to log in
Why is the conclusion repeated?
The problem is this.
Created a theme for WordPress
Started making a gallery for it
First, albums are displayed on the main page.
Then, when you click in the modal window, all the photos appear
. And then just when you click on the photo, the Fancybox modal opens and that's it.
But the problem is that
in the cycle of displaying records, the cover and the name of the record are normally displayed
. But in the modal window, the title of the record and album photos are shown only for the last record
HELP
Here is the code:
<section id="photos_s">
<div class="section_title">
<h2><?php echo get_cat_name(2) ?></h2><br>
<div class="md_line bg_main_color"></div>
</div>
<div class="container">
<div class="row">
<?php if (have_posts()) : query_posts('cat=2');
while (have_posts()) : the_post(); ?>
<div class="col-md-4 p0">
<div data-toggle="modal" data-target="#myModal">
<?php the_post_thumbnail(array(100,100)); ?>
<?php the_title(); ?>
</div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><?php the_title(); ?></h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
</div>
</section>
Answer the question
In order to leave comments, you need to log in
<div data-toggle="modal" data-target="#myModal">
<?php the_post_thumbnail(array(100,100)); ?>
<?php the_title(); ?>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><?php the_title(); ?></h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
</div>
</div>
<div data-toggle="modal" data-target="#myModal<?php the_ID(); ?>">
................................
<div class="modal fade" id="myModal<?php the_ID(); ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question