Ver Mensaje Individual
  #2 (permalink)  
Antiguo 06/08/2012, 07:57
Avatar de Nekko
Nekko
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Buenos Aires
Mensajes: 3.141
Antigüedad: 16 años, 1 mes
Puntos: 656
Respuesta: Modificando plantilla wordpress - fichero index.php

No entiendo porqué repetís el bucle completo tantas veces. Pasemos en limpio, que estructura HTML querés generar? Con una vez que tires el loop con el contador ya podés ir usando condicionales sin necesidad de repetir consultas.

Te pongo algo a modo de ejemplo...

Código PHP:
Ver original
  1. <
  2. ?php $i = 1;
  3. $high_cat1 = get_option('repo_high_cat1');
  4. $high_query = new WP_Query( 'category_name='.$high_cat1.'&posts_per_page=8' );
  5. while ( $high_query->have_posts() ) : $high_query->the_post();
  6.  
  7. if($i == 1) { ?>
  8.  
  9. <div class="high-first-item">
  10. <img class="highmage" src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php get_image_url(); ?>&amp;h=91&amp;w=146&amp;zc=1" alt="" />
  11. <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
  12.     <?php wpe_excerpt('wpe_excerptlength_slide', 'wpe_excerptmore'); ?>
  13. </div>
  14. } if($i == 2) { ?>
  15.  
  16. // Tu código HTML para mostrar la entrada numero 2...
  17.  
  18. } if($i == 3) { ?>
  19.  
  20. // Tu código HTML para mostrar la entrada numero 3...
  21.  
  22. } if($i == 4) { ?>
  23.  
  24. // Tu código HTML para mostrar la entrada numero 4...
  25.  
  26. } if($i == 5) { ?>
  27.  
  28. // Tu código HTML para mostrar la entrada numero 5...
  29. // Bueno, creo que se entiende la idea xD
  30.  
  31. }
  32. //Sumamos...
  33. $i++;
  34. endwhile; endif; ?>
__________________
Taller para crear themes wordpress desde cero | Presupuestos para trabajos particulares vía MP