Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Opa!
Sou meio iniciante em WP. Estou precisando fazer a listagem de uma categoria de maneira randomica, isto é, com a ordem dos posts totalmente embaralhada (sem ser em ordem cronológica). Isso deve acontecer em apenas uma categoria... alguém sabe como fazer?
O código que faz isso no meu template é:
<?php
if (have_posts()) :
$odd = false;
while (have_posts()) : the_post();
$odd = !$odd;
?>
<!-- begin post -->
<div class="<?php if ($odd) echo 'uneven '; ?>post">
<div class="uvod">
<a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'small', 'alt="' . $post->post_title . '"'); ?></a>
<p class="category"><?php the_category(', '); ?></p>
<p class="comments"><?php comments_popup_link('{0}', '{1}', '{%}'); ?></p>
</div>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php echo dp_clean($post->post_content, 150); ?></p>
</div>
<!-- end post -->
<?php endwhile; ?>
<div class="postnav">
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
</div>
<?php else : ?>
<div class="notfound">
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that is not here.</p>
</div>
<?php endif; ?>
</div>
<!-- END content -->
Se alguém pode me ajudar?
Obrigadão!
Carregando comentários...