Advertisement
oscarviedma

Código Bucle WordPress de Ejemplo - OV DIVI

Aug 25th, 2023
2,120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2. // El loop de testimonios
  3. $args = array(
  4.     'post_type' => 'testimonios',  // Nombre de la Custom Post Type
  5.     'posts_per_page' => -1,       // Mostrar todas las entradas
  6. );
  7.  
  8. $testimonios_query = new WP_Query($args);
  9.  
  10. if ($testimonios_query->have_posts()) {
  11.     while ($testimonios_query->have_posts()) {
  12.         $testimonios_query->the_post();
  13.         ?>
  14.         <div class="testimonial">
  15.             <h2><?php the_title(); ?></h2>
  16.             <div class="testimonial-content">
  17.                 <?php the_content(); ?>
  18.             </div>
  19.         </div>
  20.         <?php
  21.     }
  22.     wp_reset_postdata(); // Restablecer los datos del bucle
  23. } else {
  24.     echo "No se encontraron testimonios.";
  25. }
  26. ?>
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement