I have comments on posts and pages, I'd like the post's comments to display from oldest to newest, but on pages to display from newest to oldest.
Is this possible and if so, how?
I have comments on posts and pages, I'd like the post's comments to display from oldest to newest, but on pages to display from newest to oldest.
Is this possible and if so, how?
Anyone?
What code are you currently using to display comments?
Assuming your theme, like any other, uses wp_list_comments() inside comments.php, then just add the following parameter.
reverse_top_level
..setting the value to either 0 or 1, depending on which order you want..
Info on function:
http://codex.wordpress.org/Template_Tags/wp_list_comments
NOTE: The above parameter isn't documented, but does work (tested it).
Look at using a conditional tag in the comments file along with the new parameter.
Info on conditions:
http://codex.wordpress.org/Conditional_Tags
Let's assume you have something like this..
<ol class="commentlist">
<?php wp_list_comments(); ?>
</ol>
Update that with, something along the lines of..
<ol class="commentlist">
<?php if(is_page()) : wp_list_comments('reverse_top_level=1'); else : wp_list_comments(); endif; ?>
</ol>
See how far that gets you.. ;)
This topic has been closed to new replies.