Filter Wordpress gallery according to the click on the Post

0

Speak people, I have a carousel where I publish some photos through post in wordpress and I need that when I click on the title of the post in the sidebar, the corresponding gallery appears, someone suggest me how can I do? Thank you!

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

    
asked by anonymous 03.09.2018 / 05:21

0 answers