Notifications
Clear all
Limited Support
Our team is currently on holiday, so support will be limited during this period. Response times may be slower than usual, and some inquiries may be delayed. We appreciate your patience and understanding, and weβll resume our usual support by the end of August.
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;
Β Β Β }
}