wordpress - having comments inline ajax like in stackoverflow wordpress - having comments inline ajax like in stackoverflow wordpress wordpress

wordpress - having comments inline ajax like in stackoverflow


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 »</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;">« 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 »</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;">« 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.


I think AJAXed Wordpress does what you're looking for, among other things:

AJAXed Wordpress

AJAXed Wordpress (AWP) harnesses the power of both AJAX and Wordpress to improvethe user experience, the administration capabilities and the design potential ofany Wordpress based blog. It works on all WordPress versions from 2.1 - 2.6.

Some of AWP’s features include loading posts inline, inline comments, threadedcomments, AJAX comment submission, AJAX Navigation, live comment preview and muchmore. AWP is endlessly customizable and extensible. Even though AWP provides manyfeatures, you are never forced to use features that you don’t want. All aspects ofthe plugin are easily customized through a single Administration panel.

Demo is available here http://wordpress.mu/ and you can see the inline comments in action. Looks like what you were asking for.


You could repurpose code from P2 theme. It's a rather well written theme so this should largely work without any problems. Copy all the code from their functions.php to the bottom of your theme's functions.php. Copy their inc directory and entry.php to your theme directory.

Replace in your index.php

  <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     <?php /* your themes code must be here */ ?>  <?php endwhile; ?> 

with

  <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>     <?php  require dirname(__FILE__) . '/entry.php'; ?>   <?php endwhile; ?> 

and then modify the css and other stuff in entry.php to taste.