Bom dia,
Ando aqui a martelar para tentar meter os últimos comentários primeiro no meu blog.
Andei a pesquisar e encontrei isto
http://www.wpthemesplugin.com/how-to-rearrange-wordpress-comments-latest-on-top/ mas não fiquei muito satisfeito por ter de andar a mudar ficheiros de base do próprio wordpress, no entanto ao ler os comments vi la isto:
hi moses, you can get the same result by using array_reverse php function to the $comments array before comment loop in comments.php file.
pois isto já me agradou, até porque me pareceu mais simples.
ora no meu comments.php entre outras coisas que não acho muito relevantes, tenho la isto:
<!-- You can start editing here. -->
<?php if ($comments) : ?>
<h3 id="comments"><?php comments_number('Sem comentários', '1 comentário', '% comentários' );?> a “<?php the_title(); ?>”</h3>
<ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<cite><?php comment_author_link() ?></cite> Says:
<?php if ($comment->comment_approved == '0') : ?>
<em>O seu comentário aguarda moderação.</em>
<?php endif; ?>
<br />
<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small>
<?php comment_text() ?>
</li>
<?php
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?>
<?php endforeach; ?>
</ol>
<?php else : ?>
<?php if ('open' == $post->comment_status) : ?>
<?php else : ?>
<p class="nocomments">Comentários fechados.</p>
<?php endif; ?>
<?php endif; ?>
Segundo o comment pensei que bastase meter
<?php array_reverse ($comments);?>
antes do foreach , mas ou estou a fazer alguma coisa de errado (não percebo nada de especial de php) ou esta solução não funciona...
alguém me sabe ajudar?