Filter Wordpress gallery according to the click on Post

Asked

Viewed 32 times

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

inserir a descrição da imagem aqui

  • You want to take to the corresponding post of the image is this?

  • 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

  • But how did you link the photos to the post? has enough shapes

  • I created the gallery by using the Advanced Custom Field Plugin, and linked it to my post

  • 1

    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

  • 1

    I would prefer to use via ajax to have a nice effect

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.