Problem:
I need to show informations about a User on a User Single page. For example:
On /author/user1 I want to show user1 name and profile picture.
On /author/user2 I want to show user2 name and profile picture.
Solution:
1. Please add this code in your theme’s or child theme’s functions.php file:
function get_user_id() { $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); return $author->ID; } add_shortcode( 'get_user_id', 'get_user_id' );
2. Register the ‘get_user_id’ shortcode first in Toolset >> Settings >> Front-end Content >> Third-party shortcode arguments.
3. Then use shortcode like this in the Author Archive View:
[wpv-user field="user_login" id="[get_user_id]"] [wpv-user field="profile_picture" id="[get_user_id]"]
WP Author Templates are below, currently we are talking about author.php:
https://codex.wordpress.org/Author_Templates#Which_Template_File_is_Used.3F
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | 12:00 – 17:00 | - |
- | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | 18:00 – 21:00 | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
This topic contains 6 replies, has 2 voices.
Last updated by 7 years, 3 months ago.
Assisted by: Noman.