WordPress ajax comments inline plugin
This plugin displays ajax comments inline when one of the comment-popoup-link of your wordpress blog posts is clicked, you can click to show or hide the inline ajax comments (Show comment form if no comment reply yet),Show it directly in your wordpress blog’s home/main page,category page or tag page (index.php/archive.php).This makes users view or post comment reply more easily.

Download: WordPress ajax comments inline
Features
Show/Hide ajax comments inline
Click the “Show comments” link of one post in your wordpress blog’s home page(or category,tag archive page etc.) ,then the inline ajax comments for this post would be displayed below.This plugin uses jQuery ajax to get the comments from server,so only the comments area would be refresh, save bandwidth and make your wordpress blog be loaded much faster.After that,you have a choice to collapse the ajax comments by clicking the “Hide Comment” link.
The comment form would be displayed inline if there is no comment yet. So the users could post comments directly for each post in the home page or category/tag/archive page etc, do not need to get into the single article page to post reply comments.Also the comment form could be collapsed.
Availabe to set Comment order and Comment number
In the WordPress Ajax Comments Inline Options admin page, you can choose how many comments to be displayed in the inline ajax comment field, set the new or old comments displayed first.
Choose to use Google jQuery CDN or not
This plugin requires the most popular jQuery javascript framework,it loads Google jQuery CDN (content delivery network) by default. There are many advantages for serve jQuery from Google hosted api CDN, such as user browser cache,reduce server bandwidth request, decreased latency, increased parallelism and better caching,which decribed by Dave Ward.
However,for some reason, you could choose to load jQuery from your wordpress blog’s own jQuery libraries. To fit your preference,just set the option of Inline Ajax Comments plugin in the dashboard admin page.
Demo && Testing
Note: I have disabled the comment function in the demo blog as there are so many spams
.There will be a comment form when you click “leave a comment” if the comments of the post are open.
Installation
- Upload WordPress Ajax Comments Inline plugin to your wordpress blog’s `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress Dashboard.
- Place
<?php show_hide_comments_link(); ?>in your theme’s template file where you want the “Show Comments” / “Hide Comments” link to be displayed. - Place
<?php display_ajax_comments(); ?>in your theme’s template file where you want the ajax comment field (or comment form) to be displayed. - You can place the short code above in your theme’s index.php (or home.php,front-page.php: display inline ajax comments in wordpress blog’s home page), or archive.php(category.php,tag.php,date.php etc: display inline ajax comments in the category or tag page…).Take a look at the example bellow for details.
- If the css style doesn’t suit for your theme, you can modify the file wp-ajax-comments-inline/wpaci_style.css in the plugin directory to custimize how it looks.
- Go to the admin page: *Dashboard-Plugins-Inline Ajax Comments* to set the settings if you don’t want the default one.
Example 1: modified index.php
<?php while ( have_posts() ) : the_post(); ?> ..... <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-meta"></div><!-- .entry-meta --> <div class="entry-content"></div><!-- .entry-content --> <div class="entry-utility"> <span><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> <?php show_hide_comments_link(); ?> </div><!-- .entry-utility --> <?php display_ajax_comments(); ?> </div><!-- #post-## --> <?php endwhile; // End the loop. Whew. ?>
Example 2: modified loop.php
<?php if(comments_open()) : ?>
<p>
<?php comments_popup_link(__('Leave a comment?','wapi') , __('1 comment','wapi') , __('% comments on ','wapi') .get_the_title(), 'comments-link', __('Comments are closed for this post','wapi') ); ?>
<?php show_hide_comments_link(); ?>
</p>
<?php display_ajax_comments(); ?>
<?php endif; ?>
Best Practice: Search the default wordpress comment link display funtion: comments_popup_link, place <?php show_hide_comments_link(); ?> after it outside the html tag ”<span>…</span>” which surround it, or replace the whole <?php comments_popup_link(.......; ?> whith <?php show_hide_comments_link(); ?>.
Then search </div> or </p> from this position below, place <?php display_ajax_comments(); ?> just after the first found </div> or </p> tag.
Note: The short code must be placed in the loop, as in this example, put it between <?php while ( have_posts() ) : the_post(); ?> and <?php endwhile; // End the loop. Whew. ?> .
WordPress ajax comments inline FAQ
Could I replace my wordpress themes’ default comments-popup link?->Of course you can. Just replace
<span><?php comments_popup_link(....)?></span>with <?php show_hide_comments_link(); ?>.
Where to display the php code? -> Look at the example above.
Uninstallation
Remember to comment out (or remove) the php template tag code in the theme file before you disable the WordPress Ajax Comments Inline Plugin:
<?php // show_hide_comments_link(); ?></div><?php // display_ajax_comments(); ?>
Change log
= 1.1 = Update
- Fix bug: Fix the bug when the code is placed at the none main page(category page etc.),the error `Failed to get comments:error` occur.
- New feature added: Add comment form in the bottom of ajax comments field if the posts already have comment.So the comment form could be clicked to display whether the post has comments or not.
= 1.0 =
This is the first version of WordPress ajax comments inline plugin, please reply to report bug here if you found.
:
:
:
:
How can I also add comment form if the posts already have comment?
I’d be appreciated if you make it a feature
Good advice,this feature would be considered in the next version of WordPress ajax comments inline plugin.
Some content
lets try this
trying
But it’s only work with default permalink.
I have “Failed to get comments:error” with custom permalink (/blog/%postname%/).
How can i do to get it work ?
Answer please ^^ your plugin is very cool, simple and light. It’s just what i want !
Hi,could you give more details about your problem? It works in my blog with my custom permalink (/archives/%postname%.html). eg: give your blog url or where you placed the code
< ?php show_hide_comments_link(); ?>and< ?php display_ajax_comments(); ?>.Hi !
I’ve resolved the problem, thanks for this great plugin !
Firstly the update was not working with my permalink : i’ve had the same problem that with the 1.0 version.
Finally i found the problem : I have a static front page on my site, the blog is another one page.
I’ve reactivate the default blog page, and the plugin works great.
Then, I’ve reactivate my own static front page… and it works too -__-’ haha !
so, everything is working well !
I hope it will serve you !
Thank you again for this plugin !
Hello FarLee,
I get error when i clieck ” Leave a Reply ”
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 95
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/politilist/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 96
Thank you
M
aad
some conetn
Here my blog where you can see the problem.
http://www.les-deux-flos.com/blog/
There’s no modification on your original plugin.
I’m sorry, i’m not a programmer, so i can’t really identify the problem !
hope it will help you.
(sorry for my english, i’m french ^^)
Hi,your blog url is broken now.
The part of my loop :
tinypaste.com/f8799
I use twentyten theme.
is this an ajax post?
please ignore the previous comment…
aha, it’s without ajax post, as I think ajax post will not lead visitor to the single article page, which results your site visitor doesn’t have the chance to view your article details,and reduces your site page view.However, I would consider to add this feature as an option to the WordPress Ajax Comment Inline (waci) plugin when the new version is updated, maybe this weekend.
please please please add ajax post!!!
just checking…
just checking too
jus testing
Hi,
Love the plugin! Would you consider adding support for the new WordPress 2.7+ comment features (basically, the new wp_list_comments() function) to allow for inline nested comments and replies? I’ve just been trying to adjust that myself but my programming skills are shaky…
Cheers,
Vince
Hello, there!
First of all, congratulations for this plugin. It’s all I ever wanted. Simple, usefull, and fast. Thank you very much!!!
Wondering if there is a way to make the comments always open by default. In a “no comments” post it should be the link to display/hide the comment form…
Again, thank you very very much!!!!!
features (basically, the new wp_list_comments() function) to allow for inline nested comments and replies? I’ve just been trying to adjust that myself but my programming skills are shaky
雷锋
Hello,
nice plugin. I was a little surprised to see that commenting redirected automatically the visitor to the post but I can understand your reason. It’s just strange because I think people will install the plugin to reduce the circulation into the blog. It could be nice to have an option to stay on the page where the comment is created.
I agree. It would be very nice if the comment form submission was AJAX also, so the user stayed on the home page when they submitted.
Thanks for the great plugin!
es una poronga esto! chino puto
Is There a way to change the wording of the comment links without changing your code in the plugin php? For instance I don’t want it to say ‘Comment Shortcut’ I just want it to say ‘Comment’. And I’d like to remove the ‘|’ before the word comment. I’d rather not have to edit your plugin code though because I’ll always have to do that everything you make updates and rather not for something so minor. thanks!
A little test.
Thank you For the post its very intresting
Hi there. Where should I insert this into my php? I honestly can’t get it to work.
Here is a copy of my index php file:
http://www.snapoftheshutter.com/random/test-page/
Hi, Peter, You can replace
< ?php comments_popup_link( __( ‘Leave a comment’ ), __( ’1 Comment’ ), __( ‘% Comments’) ) ?> </div>with< ?php show_hide_comments_link(); ?> </div> < ?php display_ajax_comments(); ?>This does not seem to be working with 3.1.3. Your instructions say to install into index.php, but actually I think it needs to go into loop.php. I tried that but nothing shows up. Any help would be appreciated.
Nevermind, I got it to work. It seems there is similar text 2 times in the code, and you need to paste this in the second set.
Is there a way to keep the user on the home page, if that is where they filled out the comment at?
Hi,Jason,Do you mean ajax posting in the home page? I am considering to update this feature in the next version.
Yes. I wanted the inline comments, so people can make comments quickly. I look forward to the next version and I hope you include.
Also, a feature of having the comments already expanded, would be nice. Is there a way to customize that currently?
yes, i would like to find a way for the comments to be expanded by default! help??
I too would like to have this installed, currently I have a static page on my homepage, but my goal is to have my blos posts show up on the homepage with comments being featured aswel. So people can comment from the home page. Similar to Jason question. Would it work on this theme? buikspierentrainenx.nl
testing comment
Hello
I get error when i clieck ” Leave a Reply ”
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 95
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/politilist/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 96
Thank you
M
tttttttttttttttttttttttttttttt
testando aqui do brasil
I’m having trouble with this. I have version 1.1 installed and get the error, Failed to get comments: error. People are able to leave comments, they just aren’t displaying. Site is: http://www.pobkephotography.com/blog.
What could be causing this? I checked the my code is correct.
Thank you.
Link View does not work, let’s say if we restrict the display of the 10 comments.. please help!
Thanks.
By the way the script is excellent!
nao sei se funciona
Is running or not!??
Testing.
nice
thread ed’s comment
Hi, I love this plugin. But I’m trying to use it, for a little different use.
I want to add it, on each single page/post with comments. And that it show, for example, 20 comments, and each time you click on “View” it loading the next 20 comments.
Would it be a total different plugin or it’s something that this one can do with small changes?
I would love the plugin to have this “feature” Hope you can consider making this as an optional
Thanks a lot.
teste
DFHFDHDH
TESTNG
aaa
test
Hello
I get error when i clieck ” Leave a Reply ”
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 95
Notice: Undefined variable: req in /home/xxxx/public_html/xxxx/politilist/wp-content/plugins/wordpress-ajax-comments-inline/ajax-comments-inline.php on line 96
Thank you
M
您好,在使用你的这个插件时遇到一个问题,就是我把语句放到了我的主题首页index.php,要怎么实现点击展开评论框后可以ajax评论,而不刷新页面。希邮件联系回复。非常感谢
Hello! edkedkd interesting edkedkd site! I’m really like it! Very, very edkedkd good!
test asdasda
Hi Far,
as first thing I want to express my admiration for your work. The plugin seems very useful, but I don’t reach in using all his functions.
I’ve put the code into my index.php file, and the form appears correctly, so that people can add comments also in the home page, from the link “visualizza i commenti” under the title of each article.
But I’m not able to show in the same manner the comments that already are in the article. What I would it’s a link that allow you to add a comment (and this one already work great), and an other one that make the comments appear in the position that I want (I think I will put it under each article): my purpose it’s to make every article commentable not leaving the home page, like in Facebook.
Is this possible? Can you gently help me?
In this moment the comments in my site are showed by this code:
Thank you! : )
Hi,Sergio. The plugin have the feature of showing the comments already posted in the article as you described. If the error “Failed to get comments:error” occured, pls confirm that the code “< ?php display_ajax_comments(); ?>” has been placed in your theme’s template file too. And try to reinstall the plugin.
Please check the demo.http://farlee.info/t/
Hi Far,
thank you for your help.
I placed the code in my index.php theme file, and I tried it in many positions obtaining the same result.
Do I have to put some code into the parentheses? I also tried to put there the permalink ‘/%year%/%monthnum%/%day%/%postname%/#comments’, but nothing changed.
Wow, don’t give attention at my last reply: I fixed the problem!
I reinstalled the plugin, but apparently nothing happened. Then I repaired permissions of my site from the admin control panel of my web hosting (Aruba), and magically the plugin worked!
Thank you very much for your help and for your work on this plugin: I will make a donation and I invite everyone who use your code to follow my example!
Glad to hear that this plugin can help you something.
sd’lf’sdla’flasd’fl’asd
Іt’s an remarkable article for all the internet people; they will obtain benefit from it I am sure.
TEST123