Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » WordPress »

Agregar un div cada 4 post

Estas en el tema de Agregar un div cada 4 post en el foro de WordPress en Foros del Web. Hola a todos, estoy modificando mi otro blog en wordpress y me surgio un problema, tengo la variable post() en wordpress que muestra 12 post. ...
  #1 (permalink)  
Antiguo 21/05/2012, 15:56
 
Fecha de Ingreso: diciembre-2010
Mensajes: 160
Antigüedad: 13 años, 4 meses
Puntos: 1
Agregar un div cada 4 post

Hola a todos, estoy modificando mi otro blog en wordpress y me surgio un problema, tengo la variable post() en wordpress que muestra 12 post.

cada post tiene un "divjuego" que muestra el cover del juego.

lo que necesito es que cada 4 post, se agregue un "divbox" para que queden 3 filas.

les dejo una imagen para que se den cuenta.



Si alguien tiene una idea de como hacerlo, se los agradeceria mucho!
  #2 (permalink)  
Antiguo 22/05/2012, 18:56
 
Fecha de Ingreso: abril-2011
Ubicación: Colombia
Mensajes: 59
Antigüedad: 13 años
Puntos: 19
Respuesta: Agregar un div cada 4 post

Bueno. Inicio.. de la idea de que solo tienes 12 post; entonces este código te serviría

Código PHP:
Ver original
  1. <div style="background-color:blue;">
  2. <?php query_posts('showposts=4'); ?>
  3. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  4. <h2><?php the_title(); ?></h2>
  5. Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', '); ?>
  6. <?php endwhile; endif; ?></div>
  7.  
  8. <div style="background-color:red;">
  9. <?php query_posts('showposts=4&offset=4'); ?>
  10. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  11. <h2><?php the_title(); ?></h2>
  12. Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', '); ?>
  13. <?php endwhile; endif; ?></div>
  14.  
  15. <div style="background-color:blue;">
  16. <?php query_posts('showposts=4&offset=8'); ?>
  17. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  18. <h2><?php the_title(); ?></h2>
  19. Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', '); ?>
  20. <?php endwhile; endif; ?></div>

Etiquetas: cada, post, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:47.