Support » Requests and Feedback » Reply with quote

  • injinuity


    I am not talking about threaded comments, thats way too messy. I was wondering if it would be easy to create a ‘reply with quote’ functionality as is seen on most forums.

    Jinu Johnson

Viewing 5 replies - 1 through 5 (of 5 total)
  • Kafkaesqui


    Define “easy.”

    A quick and dirty php way of working this — could probably do something with javascript, but for that I’d have to do some looking up — add the following code block into the comment form textarea tag (<textarea> <em>here</em> </textarea>) of the comments.php template for your theme:

    if(isset($_GET['reply-quote'])) :
    $reply_quote = $_GET['reply-quote'];
    $quote_comment = $wpdb->get_row("SELECT comment_author, comment_content FROM $wpdb->comments WHERE comment_ID = $reply_quote LIMIT 1");

    echo "<blockquote>\n<cite>" .
    $quote_comment->comment_author .
    " said:</cite>\n" .
    apply_filters('get_comment_text', $quote_comment->comment_content) .

    And in an appropriate place in the comment loop, if you use default permalinks (/?p=#) on your blog, add this:

    <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&reply-quote=<?php comment_ID() ?>#postcomment">quote in comment</a>

    If you use custom permalinks, go with:

    <a href="?reply-quote=<?php comment_ID() ?>#postcomment">quote in comment</a>



    Hey thanks for the tip my friend.. I shall try and let you know how successful I was…


    Absolutely brilliant my friend. I am implementing it, and its 80% perfect, the only thing is to have the text quoted inside the textarea input box…

    it works.. it works.. it works.. I had just placed the code, on the wrong line… now its perfect.. I just have to get the mouse focus corrected thats all.. else works perfectly.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Reply with quote’ is closed to new replies.