Código para gerar dois estilos de post

  • Autor Autor sebasxnco
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
S

sebasxnco

Épsilon
hola que tal amigos, tengo una duda tengo el siguiente código para generar dos estilos de post o al menos eso creo quiero logro algo como lo de la imagen

http://twitpic.com/5zomkf/full

sitio web de la imagen Skatter Tech

PHP:
<div class="hubtitle"> <a title="Películas, Muisca, Series, TV, Canales…" href="http://sitio.com/categoria/entretenimeinto/"> <span>Entretenimiento</span> <span class="viewall">Ver...</span> </a></div>

                    <?php
    $my_query = new WP_Query('cat=3, 10, 6, 7, 9, 9&offset=0&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
?>
<div class="previewitem"> 
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img width="312" height="125" src="<?php echo get_post_meta($post->ID, "Image", true);?>" class="attachment-gallery wp-post-image"></a>
</div>

<div class="largeitem"> 
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div>
<?php endwhile; ?>	

<ul>

                    <?php
    $my_query = new WP_Query('cat=3, 10, 6, 7, 9, 9&offset=1, 2, 3, 4, 5&showposts=5');
    while ($my_query->have_posts()) : $my_query->the_post();
?>
<li class="smallitem"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>	

</ul>

señores que pena ya solucione el codigo para hacerlo por si alguien quiere es


PHP:
<div class="hubtitle"> <a title="Películas, Muisca, Series, TV, Canales…" href="http://sitio.com/categoria/entretenimeinto/"> <span>Entretenimiento</span> <span class="viewall">Ver...</span> </a></div>

                    <?php
    $my_query = new WP_Query('cat=3, 10, 6, 7, 9, 9&offset=1&showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
?>
<div class="previewitem"> 
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img width="312" height="125" src="<?php echo get_post_meta($post->ID, "Image", true);?>" class="attachment-gallery wp-post-image"></a>
</div>

<div class="largeitem"> 
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</div>
<?php endwhile; ?>	

<ul>

                    <?php
    $my_query = new WP_Query('cat=3, 10, 6, 7, 9, 9&offset=2&showposts=5');
    while ($my_query->have_posts()) : $my_query->the_post();
?>
<li class="smallitem"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>	

</ul>
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
para empezar offset tiene como argumento un número únicamente, el desplazamiento desde 0. Si quieres que no aparezca el primer post, debes usar 1. Si quieres que aparezca a partir del tercero, usa 2, etc.

Y la otra es que después de usar el wp_query debes hacer un reset de la consulta...


En mi opinión, con un contador, el segundo loop no es necesario. Pero esa es solo mi opinión.
 
Voltar
Topo