メモ6(WordPress3.1上のDISQUSプラグインでのエラーの修正方法)
最新版では修正済み
DISQUSプラグインを入れたらコメント管理の所でこんなエラーがでました
Warning: number_format() expects parameter 1 to be double, string given in /wp-includes/functions.php on line 155
ググッてみるとDISQUSプラグイン側が悪いようで修正方法が載ってましたが
英語文献しかなかったのでメモしときます
元記事:Fix: WordPress 3.1 and Disqus Plugin Error When Returning Comments Count | Techerator
直し方
*注意 バックアップを取る事をお勧めします
まず/wp-content/plugins/disqus-comment-system/disqus.phpの
692行目あたりのこの部分を
function dsq_comments_number($count) { global $post; if ( dsq_can_replace() ) { return '<span class="dsq-postid">'.$count.'</span>'; } else { return $count; } }
このコードに置換します[PHP num=692]function dsq_comments_number($count) { global $post; return $count; }[/PHP]
これでエラーは出なくなりますがテーマーの中でcomments_number()
関数を使用してる場合追加でこのように修正すれば直るそうです
697行目あたりのこの部分を
[PHP num=697]function dsq_comments_text($comment_text) { global $post; if ( dsq_can_replace() ) { return 'View Comments'; } else { return $comment_text; } }[/PHP]
このコードに置換
[PHP num=692]function dsq_comments_text($comment_text) { global $post; $number_of_comments = get_comments_number(); return $number_of_comments; }[/PHP]
#追記
プラグインのv2.65で修正されました