wordpress - 有评论内联ajax像在stackoverflow [英] wordpress - having comments inline ajax like in stackoverflow

查看:168
本文介绍了wordpress - 有评论内联ajax像在stackoverflow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个wordpress博客,并希望给人们相同的用户体验添加评论是在stackoverflow。有很多评论ajax插件,但我找不到一个工作,允许你在主页上内联,进入和添加评论,而无需先深入到一个单独的单个帖子页面。

$

解决方案

任何人都可以在这里使用wordpress插件或php代码来执行此操作。 >我从来没有能够让AJAX的Wordpress做我想做的事情(显然是提问者)。



我使用一个自定义解决方案,名为 Inline Ajax评论。我有一个时间找到一个下载链接,但下面是一个仍然可以工作: http ://kashou.net/files/inline-ajax-comments.zip



在WordPress主题编辑器中,我编辑index.html。之后:

 <?php the_content(''); ?> 

我添加(当然启用插件后):

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

然后我编辑了插件PHP文件本身。我注释掉了以下代码块:

  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;>显示评论& 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;隐藏评论< / 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;>显示评论& 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,这就是我必须做的,但让我知道,为你工作。我试图逆向工程我自己的解决方案,因为它似乎正是你想做的,以及。


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.

解决方案

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.

这篇关于wordpress - 有评论内联ajax像在stackoverflow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆