Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wordpress - having comments inline ajax like in stackoverflow

i have a wordpress blog and want to give people the same user experience for adding comments that is in stackoverflow. There are a number of comments ajax plugins out there but i can't find a working one that allows you to inline on the main page, go in and add comments without first drilling down into a seperate single post page.

Can anyone help here with either a wordpress plugin or php code to do this.

like image 793
leora Avatar asked Oct 13 '08 08:10

leora


1 Answers

I was never able to get AJAXed Wordpress to do what me (and apparently the questioner) want to do.

I use a custom solution that makes use of a plug-in called Inline Ajax Comments. I had a heck of a time finding a download link, but here's one that still works: http://kashou.net/files/inline-ajax-comments.zip

In WordPress' theme editor, I edit index.html. After the following:

<?php the_content(''); ?>

I add (after enabling the plug-in of course):

<?php ajax_comments_link(); ?>
<?php ajax_comments_div(); ?>

I then edited the plugin PHP file itself. I commented out blocks of code as follows:

if ($comment_count == '1') {
    echo('<span id="show-inline-comments-'. $id .'">  ');
    /*  echo('<a href="javascript:;" id="show-inline-comments-link-'. $id .'" onmouseup="ajaxShowComments('. $id .', \''. $throbberURL .'\', \''. $commentpageURL .'\'); return false;">show comment &raquo;</a>'); 
*/
    echo('</span>');
    echo('<span id="hide-inline-comments-'. $id .'" style="display: none;">  ');
    /*  echo('<a href="#comments-'. $id .'" onmouseup="ajaxHideComments('. $id .', \''. $throbberURL .'\', \''. $commentpageURL .'\'); return true;">&laquo; hide comment</a>'); 
*/
    echo('</span>');
} else if ($comment_count > '1') {
    echo('<span id="show-inline-comments-'. $id .'">  ');
    /*  echo('<a href="javascript:;" id="show-inline-comments-link-'. $id .'" onmouseup="ajaxShowComments('. $id .', \''. $throbberURL .'\', \''. $commentpageURL .'\'); return false;">show comments &raquo;</a>'); 
*/
    echo('</span>');
    echo('<span id="hide-inline-comments-'. $id .'" style="display: none;">  ');
    /*  echo('<a href="#comments-'. $id .'" onmouseup="ajaxHideComments('. $id .', \''. $throbberURL .'\', \''. $commentpageURL .'\'); return true;">&laquo; hide comments</a>'); 
*/
    echo('</span>');
}

IIRC, that's all I had to do, but let me know if that doesn't work for you. I'm trying to reverse engineer my own solution since it seems to be exactly what you want to do as well.

like image 64
coderGeek Avatar answered Sep 19 '22 10:09

coderGeek