http://codex.wordpress.org/Function_Reference/count_user_postsから次の関数を使用しようとしています
function count_user_posts_by_type($userid, $post_type='post') {
global $wpdb;
$where = get_posts_by_author_sql($post_type, TRUE, $userid);
$count = $wpdb->get_var( \"SELECT COUNT(*) FROM $wpdb->posts $where\" );
return apply_filters('get_usernumposts', $count, $userid);
}
しかし、次のエラーが発生します。
Parse error: syntax error, unexpected '"', expecting T_STRING in .../wp-content/themes/aa/functions.php on line 106
私のテンプレートでは、2つの方法で使用してみました。
$authorcount = count_user_posts_by_type($author->ID, 'videos');
と
$authorcount = count_user_posts_by_type($author->ID, $post_type='videos');
構文エラーが何であるかを誰かが指摘できますか?
ありがとう!