{"id":2550,"date":"2011-12-09T13:43:04","date_gmt":"2011-12-09T08:13:04","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=2550"},"modified":"2011-12-09T13:43:04","modified_gmt":"2011-12-09T08:13:04","slug":"sort-comment-in-reverse-order-wordpress","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/sort-comment-in-reverse-order-wordpress\/","title":{"rendered":"Sort comment in reverse order &#8211; WordPress"},"content":{"rendered":"<p>In many cases the blogger may want to sort the comment of there WordPress blog by latest comment at top, like me.<\/p>\n<p>Instead of installing any plugin, i have done following code changes in &#8220;<strong>comments.php<\/strong>&#8220;.<!--more--><\/p>\n<p>Somewhere in &#8220;<strong>comments.php<\/strong>&#8220;, you will find below line of code &#8211;<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\nforeach ($comments as $comment) :\n<\/pre>\n<p>Add following code just above the for loop<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\n$comments = array_reverse($comments);\n<\/pre>\n<p>so, the final code will become<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\n\t\/*Start By Jitendra*\/\n\t$comments = array_reverse($comments);\n\t\/*End By Jitendra*\/\n\tforeach ($comments as $comment) :\n?&gt;\n<\/pre>\n<p>I hope, this little trick will be very useful for few WordPress bloggers.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP code to sort the comment in WordPress blog in reverse order<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[17,19],"tags":[223],"class_list":["post-2550","post","type-post","status-publish","format-standard","hentry","category-tips","category-webtech","tag-wordpress"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":39,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/how-to-change-the-meta-tag-link-in-wordpress\/","url_meta":{"origin":2550,"position":0},"title":"How to change the Meta Tag link in WordPress","author":"Jitendra","date":"May 6, 2010","format":false,"excerpt":"How to change the Meta Tag link in Wordpress","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2386,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/cpanel-filezilla-ftp-all-code-converted-in-single-line\/","url_meta":{"origin":2550,"position":1},"title":"Cpanel &#8211; FileZilla FTP &#8211; All code converted in single line","author":"Jitendra","date":"August 12, 2011","format":false,"excerpt":"While transferring the php, html or javascript file using filezilla ftp client to the cpanel - all the codes converted into single line","rel":"","context":"In &quot;Web Technology&quot;","block_context":{"text":"Web Technology","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/"},"img":{"alt_text":"FileZilla Settings","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2011\/08\/FileZilla-Settings.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2903,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-toolkit-for-php\/","url_meta":{"origin":2550,"position":2},"title":"Salesforce Toolkit for PHP","author":"Jitendra","date":"June 7, 2012","format":false,"excerpt":"Example of using PHP toolkit in Salesforce with Sample code","rel":"","context":"In &quot;Force.com&quot;","block_context":{"text":"Force.com","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/force-com\/"},"img":{"alt_text":"force.com toolkit for PHP toolkit","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/force.com-toolkit-for-PHP-toolkit.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/force.com-toolkit-for-PHP-toolkit.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/06\/force.com-toolkit-for-PHP-toolkit.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":104,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/display-author-name-in-wordpress\/","url_meta":{"origin":2550,"position":3},"title":"Display author name in wordpress","author":"Jitendra","date":"May 11, 2010","format":false,"excerpt":"Look in the default theme's index.php file for the proper template tag: [sourcecode language=\"php\"] <code><?php the_author() ?><\/code> [\/sourcecode] and a good place to put it. Display Author's 'Public' Name Displays the value in the user's\u00a0Display name publicly as\u00a0field. [sourcecode language=\"php\"] <p>This post was written by <?php the_author();\u00a0?><\/p> [\/sourcecode] Get Author\u2026","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1538,"url":"https:\/\/www.jitendrazaa.com\/blog\/others\/tips\/wordpress-update-error-allowed-memory-size-exhausted\/","url_meta":{"origin":2550,"position":4},"title":"wordpress update error &#8211; allowed memory size exhausted","author":"Jitendra","date":"February 20, 2011","format":false,"excerpt":"wordpress update error - allowed memory size exhausted","rel":"","context":"In &quot;Tech Tips&quot;","block_context":{"text":"Tech Tips","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/others\/tips\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1848,"url":"https:\/\/www.jitendrazaa.com\/blog\/webtech\/cpanel-php-500-internal-server-error\/","url_meta":{"origin":2550,"position":5},"title":"CPanel &#8211; PHP &#8211; 500 internal server error","author":"Jitendra","date":"March 28, 2011","format":false,"excerpt":"Error Resolved - CPanel - PHP - 500 internal server error","rel":"","context":"In &quot;Web Technology&quot;","block_context":{"text":"Web Technology","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2550","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=2550"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/2550\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=2550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=2550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=2550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}