Я пытаюсь использовать следующую функцию из 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
В своем шаблоне я попытался использовать его двумя способами:
$authorcount = count_user_posts_by_type($author->ID, 'videos');
и
$authorcount = count_user_posts_by_type($author->ID, $post_type='videos');
Кто-нибудь может указать, что это за синтаксическая ошибка?
Спасибо!