Я хочу отобразить некоторые сообщения в блоге с fancybox 2. Пользователь, который хочет узнать подробную информацию о сообщении, нажмет на миниатюру сообщения, а остальная часть содержимого откроется всплывающим окном.Почему содержание fancybox одинаково в Wordpress?
Все миниатюры открываются с помощью fancybox, но на этот раз содержимое других миниатюр одинаково с первым сообщением. Вот мои коды, которые я добавил в свой файл темы.
<a href="#inline1" rel="gallery" class="fancybox"><?php the_post_thumbnail('thumbnail', array('class' => 'aligncenter')); ?></a>
<div id="inline1" style="width:400px;display: none;">
<?php the_post_thumbnail('thumbnail', array('class' => 'aligncenter')); ?><?php the_content(); ?>
</div>
А вот полную версию файла темы:
<?php
$query = ff_get_query_for_section();
?>
<!-- Logotypes Section -->
<section <?php ff_print_section_attributes($query->get('section-options'), 'small-section pt-10 pb-10');// class="small-section bg-dark pt-10 pb-10"?>>
<div class="container relative">
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2">
<div class="thumbnail">
<div id="content-1" class="content mCustomScrollbar">
<?php
$catquery = new WP_Query('cat=48&posts_per_page=10');
while($catquery->have_posts()) : $catquery->the_post();
?>
<ul class="referans">
<div class="reffoto"><a href="#inline1" rel="gallery" class="fancybox"><?php the_post_thumbnail('thumbnail', array('class' => 'aligncenter')); ?></a>
<div id="inline1" style="width:400px;display: none;">
<?php the_post_thumbnail('thumbnail', array('class' => 'aligncenter')); ?><?php the_content(); ?>
</div>
</div>
<div class="refyazi"><?php echo substr(get_the_excerpt(), 0,70); ?>...</div>
</ul>
<?php endwhile; ?>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End Logotypes -->
ли кто-нибудь есть какие-либо идеи о том, что? Большое спасибо!
Похоже, что вы находитесь внутри [The Loop] (https://codex.wordpress.org/The_Loop), когда эхо миниатюры, но снаружи, когда вы эхо ваших всплывающих окон. Где именно вы размещаете этот код? –
Привет, я использую тему большого потока и включает в себя некоторые файлы, специально предназначенные для темы. Я изменил файл logo-slider.php, и теперь я добавил полную версию файла в свой первый пост. @JordiNebot – Katzenliebe