There is a problem though, the sorting is not properly done. The first item on my list is a post that has 14 comments, the second has 24, the third has 3 and the fourth has 2.
This is not the correct order and it seems to read strange values because as I add comments to certain posts, they start getting up on the list, even ahead of the ones with 14 or 24 comments.
I think, however, that the problem lies behind the fact that somehow,,, the ID's of the comments get in the way and instead of counting the actual comments, it counts the ID of the comment?... I am not sure...
Counting and sorting comments issue
I am trying to list the headlines of the 4 most popular posts (posts with most comments).
This is the macro I have managed to adapt to my needs: I have taken what I have found on a previous post and changed it so that it would fit my blog.
There is a problem though, the sorting is not properly done. The first item on my list is a post that has 14 comments, the second has 24, the third has 3 and the fourth has 2.
This is not the correct order and it seems to read strange values because as I add comments to certain posts, they start getting up on the list, even ahead of the ones with 14 or 24 comments.
I think, however, that the problem lies behind the fact that somehow,,, the ID's of the comments get in the way and instead of counting the actual comments, it counts the ID of the comment?... I am not sure...
Can anyone help?
Hi Alexandru,
Sorting defaults to "text" mode (e.g. "10" comes before "2") - so you just need to add the data-type attribute to the
<xsl:sort>
instruction:/Chriztian
Thanks!
is working on a reply...