我有两个网站,一个是临时网站,一个是制作网站。它们有99%的相同设置,并且托管在同一台服务器上。它们是多站点WP安装。
我整个上午都在试图解决的问题是:在一个网站上,oEmbed for comments很好用,但在另一个网站上,它根本不起作用——它只是吐出原始URL。
我什么都试过了。我把网站上的内容一览无余。我停用了所有插件。似乎没有什么能让它起作用,而我现在,非常尴尬地,不知道是什么导致了这种差异。
非常感谢任何线索、帮助或想法。
我有两个网站,一个是临时网站,一个是制作网站。它们有99%的相同设置,并且托管在同一台服务器上。它们是多站点WP安装。
我整个上午都在试图解决的问题是:在一个网站上,oEmbed for comments很好用,但在另一个网站上,它根本不起作用——它只是吐出原始URL。
我什么都试过了。我把网站上的内容一览无余。我停用了所有插件。似乎没有什么能让它起作用,而我现在,非常尴尬地,不知道是什么导致了这种差异。
非常感谢任何线索、帮助或想法。
您可以使用oEmbed in Comments 插件。这是作者Evan Solomon在这个插件中使用的代码,我不久前在一个网站上使用过,只需将其复制到主题函数文件中,或者更好,下载他的插件:-)
class ES_oEmbed_Comments {
function __construct() {
add_action( \'init\', array( $this, \'init\' ) );
}
function init() {
if ( is_admin() )
return;
$this->add_filter();
}
/**
* Setup filter with correct priority to do oEmbed in comments
*/
function add_filter() {
// make_clickable breaks oEmbed regex, make sure we go earlier
$clickable = has_filter( \'get_comment_text\', \'make_clickable\' );
$priority = ( $clickable ) ? $clickable - 1 : 10;
add_filter( \'get_comment_text\', array( $this, \'oembed_filter\' ), $priority );
}
/**
* Safely add oEmbed media to a comment
*/
function oembed_filter( $comment_text ) {
global $wp_embed;
// Automatic discovery would be a security risk, safety first
add_filter( \'embed_oembed_discover\', \'__return_false\', 999 );
$comment_text = $wp_embed->autoembed( $comment_text );
// ...but don\'t break your posts if you use it
remove_filter( \'embed_oembed_discover\', \'__return_false\', 999 );
return $comment_text;
}
}
new ES_oEmbed_Comments;
这个documentation 指定:类型(字符串)(可选)控制返回值的格式。可能的值包括:“普通”-链接由换行符分隔的字符串</“数组”-分页链接列表的数组,可完全控制显示为了将推特引导分页样式添加到wordpress评论分页中,我希望返回是一个数组。当我在通话中添加$args时,我得不到任何回报。我的代码:<ol class=\"commentlist\" style=\"list-style: none;\"> <?php wp_list_comments(\