WordPress.org

Ready to get started?Download WordPress

Forums

Reply with quote (6 posts)

  1. injinuity
    Member
    Posted 9 years ago #

    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
    http://injinuity.blogspot.com

  2. Kafkaesqui

    Posted 9 years ago #

    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:

    <?php
    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) .
    "\n</blockquote>\n\n";
    endif;
    ?>

    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>

  3. injinuity
    Member
    Posted 9 years ago #

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

  4. injinuity
    Member
    Posted 9 years ago #

    Kafkaesqui,

    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...

    http://www.arrogantly.com/2005/03/24/helloing-again/?reply-quote=8#postcomment

  5. injinuity
    Member
    Posted 9 years ago #

    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.

  6. courtneyelizabeth
    Member
    Posted 9 years ago #

    THIS IS SOOOO MUCH EASIER THAN THE THREADED THING...lol

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.