Show random comment? (3 posts)

  1. thinkadrian
    Posted 6 years ago #

    I've looked everywhere but can't find a simple solution.

    I want to show one random comment anywhere on my site. I'd also would like to show the comment author name and link to the post in which the comment resides.

    Post list manages to show the author and link, but not the comment itself. It's also has to be in the dynamic sidebar.

    Some SQL requests could dig up the data I need, but all I find are the SQL request code, but not to initiate an SQL request using PHP.

    Any clues? Thank you in beforehand

  2. gercheq
    Posted 6 years ago #

    I am also looking for a plugin which can handle this.

    I just want to display comments of a page randomly in anywhere in my page.

  3. security_man
    Posted 6 years ago #

    in wp-includes.php around line 216 comment out the following
    $orderby = 'comment_date_gmt'; // Hard code for now

    IF your sql version allows for the RAND argument then itll work when you pass $orderby=rand in the get_comments function.

Topic Closed

This topic has been closed to new replies.

About this Topic