how to refresh div on template part?

i’m keep learning about wordpress development and i’ve developed this template-part and loop and i need that entire div#dreams-gallery refresh after a period of time, let’s say 10 seconds.

Here’s my code:



$dreams_lightbox_posts = new WP_Query($args);
$dreams_lightbox_posts = $dreams_lightbox_posts->posts;

<section role="dreams-wrapper">
    <div id="dreams-gallery" class="container-fluid">

        <?php if (count($dreams_lightbox_posts) > 0): ?>

            <div class="row">

            <?php foreach ($dreams_lightbox_posts as $key => $post ): ?>
                <?php if ($key % 12 == 0 && $key > 0): ?>

                    <div class="row">

                <?php endif ?>

                <div class="col dreams-thumb" data-title="<?= $post->post_title ?>" data-intro="<?php the_field('intro-sonho', $post->ID); ?>" data-sonho="<?php the_field('data-sonho', $post->ID); ?>" data-parceirosonho="<?php the_field('parceiro-sonho', $post->ID); ?>" data-frasesonho="<?php the_field('frase-sonho', $post->ID); ?>"> 
                    <a title="<?= $post->post_title ?>" href="#dreams-gallery">
                        <img class="img-fluid" src="<?php echo the_field('imagem-sonho', $post->ID) ?>">

            <?php endforeach ?>

        <?php else: ?>

            <p>Não existem fotos...</p> 

        <?php endif ?>



<!-- Modal dialog -->
<div tabindex="-1" class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
              <div class="modal-header">
                <h3 class="modal-title"></h3>
                <p class="modal-intro"></p>
                <button class="close" type="button" data-dismiss="modal">×</button>
            <div class="modal-body">

            </div><!--/ modal-body -->
            <div class="modal-footer">
                <div class="modal-footer-info">
                    <time><strong>Realizado a: </strong><span id="sonho"></span></time>
                    <h4><strong>Sonho patrocinado por: </strong><br><span id="parceiro_sonho"></span></h4>
                    <p id="frase_sonho"></p>
                <button class="btn btn-default" data-dismiss="modal">Fechar</button>
         </div><!--/ modal-content -->
    </div><!--/ modal-dialog -->

Any ideas? Thanks.

Read more here: how to refresh div on template part?

Leave a Reply

Your email address will not be published. Required fields are marked *