We would like to add Author Region, and total article views to our author pages. Is this possible?
I would like the Author profile to list where the author is located. What region they are in.
Is there anything I can do to get total post views? It seems to be a realistic request. Thanks.
Bruce
just to chime in; from my own projects — it’s NOT that sample, unfortunately; there aren’t any plugins I’ve seen which combine “all author views” within a theme. Normally you would do something like setup Google Analytics and apply a custom filter to the author by name, or use something like Piwik to create custom tracking per author.
The theme setup is a fairly simple one of tracking ‘views’ based on post and then writing that to a data field saved with post meta (hence why you can see that in each post custom fields). To add an additional dbase call, you would have to ALSO write another field for author with unique key separate from post key and then write that to ALL post records for that author.
You would likely need to hire a custom developer to build the dbase hooks and so forth to work with theme; but probably simpler to have a custom plugin built that can do the author lookup and then the overhead for writing multiple data fields. This would be some serious custom work, unless you’re doing a multi-site setup, where each author essentially has their own mini-site (e.g., large magazines setup unique blogs per author, and then there are unique stats by author/blog as the more typical way that’s done).
For adding something like additional author fields, you would likely need to do some custom work to add to your functions.php file and register additional record fields “per user” and then you’d have to edit the author template in theme to query/echo that custom field in the per author setup to load that info.
Neither of those are capable of being done out of the box with this, or any comparable theme unless you build those features in yourself as they’re not commonly needed by most folk as “part of theme,” since you’d lose such custom info if changing themes in some cases. So, those kinds of customizations are best done outside of the theme framework, but done via both functions.php and custom data fields which are not directly tied to, or managed by, the theme.
There are numerous plugins for adding custom user fields, and then using shortcodes in your template files.
Or you can “roll your own,” as there are hundreds of articles online for adding “custom user fields” to WordPress.
ONE example:
http://wpengineer.com/2173/custom-fields-wordpress-user-profile/
Hope that helped. Obviously the theme devs can’t build custom code for you outside of minor tweaks and CSS over-rides; they don’t do full custom stuff at this time.
I think this might be possible using a select query. You will have to troubleshoot it yourself though.
function get_meta_values( $key = '', $type = 'post', $status = 'publish', $author = '' ) {
global $wpdb;
if( empty( $key ) )
return;
$r = $wpdb->get_col( $wpdb->prepare( "
SELECT pm.meta_value FROM {$wpdb->postmeta} pm
LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
WHERE pm.meta_key = '%s'
AND p.post_status = '%s'
AND p.post_type = '%s'
AND p.post_author = '%s'
", $key, $status, $type, $author ) );
return $r;
}
Then in the author.php you do
$author_id = $part_cur_auth_obj->ID;
$total_views = get_meta_values( 'post_views_count', 'post', 'publish', $author_id );
This will return an array of data. You can manipulate this data howsoever you want.
For custom user profile fields, I think you can use Advanced Custom Fields plugin.
-
This reply was modified 11 years by
shubhra.

I am surprised this is made so complicated. The theme we are upgrading from is 5 years old and it has these features on the profile page. The site looks terrible of course but it has the features. I would expect a new theme designed for multiple authors to have a decent profile page set up. I guess I will need to hire a programmer. Thanks.
@BruceFischer – we have this on of suggestions list but please note that we have hundreds of feature requests and we try to pick the ones that will help the most people.