Notifications
Clear all
Topic starter
31/08/2016 12:38 am
Dear users,
Please use this code and make sure that your WordPress is 4.1 or higher version:
add_filter('get_the_archive_title', 'apsw_the_archive_title');
if (!function_exists('apsw_the_author')) {
function apsw_the_archive_title($title) {
global $wpdb, $post;
if ($wpdb && $post && $post->post_author && is_author()) {
$sql = "SELECT SUM(`stats`.`view_count`) FROM `" . $wpdb->prefix . "sw_statistics` AS `stats` INNER JOIN `" . $wpdb->prefix . "posts` AS `p` ON `stats`.`post_id` = `p`.`ID` WHERE `p`.`post_author` = %d;";
$sql = $wpdb->prepare($sql, $post->post_author);
$userPostsViewsCount = $wpdb->get_var($sql);
if ($userPostsViewsCount) {
$title .= " posts views($userPostsViewsCount)";
}
}
return $title;
}
}