0
Speaks guys, I have a Carousel where I publish some photos through wordpress post and I need to click the title of the post on the sidebar, the corresponding gallery appears, anyone suggests me how can I do? from now on thank!
SIDEBAR
if(have_posts()) {
while(have_posts()){
the_post();
?>
<a href="#!"><p class="text-salvador"><?php the_title(); ?> </p></a>
<?php }
}else{
// resultado caso não tenha nada publicado
Echo "<p style='color:white;' class='text-center'>Oops<br> não foi publicado nada ainda ainda</p>";
}
// Encerramento da query
wp_reset_query();
?>
GALLERY LOOP
if(have_posts()) { while(have_posts()){ the_post(); ?> <?php $images = get_field('galeria_the_hostel_rio_de_janeiro'); $size = 'full'; if( $images ): ?> <?php $n = 1; foreach( $images as $image ): ?> <?php if ( $n == 1) { echo '<div class="carousel-item active"> <img class="d-block w-100" src="'.$image["url"].'" alt="First slide"> </div>'; }else{ echo '<div class="carousel-item"> <img class="d-block w-100" src="'.$image["url"].'" alt="First slide"> </div>'; } $n++; ?> <?php endforeach; ?> <?php endif; ?>
GALLERY VIEW
You want to take to the corresponding post of the image is this?
– Anderson Henrique
So, I have a single Carousel on the right side and I will have a list with the posts on the left side, when there is the click on the post I need to call his images for this only gallery, it would be a kind of filter
– Filipe Martins Vtt
But how did you link the photos to the post? has enough shapes
– Anderson Henrique
I created the gallery by using the Advanced Custom Field Plugin, and linked it to my post
– Filipe Martins Vtt
Okay so it’s easy, but you have 2 ways to do, you want the page update? or not? If you didn’t want to use ajax
– Anderson Henrique
I would prefer to use via ajax to have a nice effect
– Filipe Martins Vtt