admin管理员组文章数量:1122826
I want every user to get a profile in the front-end of my website. So I want to visit website/user/user-name and view all the information of this user. Is this somehow possible?
I would like to do this without a plug-in. All things I'll found on Google did include a plug-in like Front-End Only Users..
I want every user to get a profile in the front-end of my website. So I want to visit website.com/user/user-name and view all the information of this user. Is this somehow possible?
I would like to do this without a plug-in. All things I'll found on Google did include a plug-in like Front-End Only Users..
Share Improve this question asked Dec 7, 2015 at 11:05 ronnyrrronnyrr 3832 gold badges6 silver badges16 bronze badges 1 |2 Answers
Reset to default 0You need to do 2 different things to achieve this.
URL Structure:
Getting the URL in your desired format: http://website.com/user/username
By default, user's archive URL is something like this http://website.com/author/username
There is a plugin to change author slug, install this plugin and set the slug to user
Plugin: https://wordpress.org/plugins/rename-author-slug/
[Note: I'm the author of this plugin]
Displaying info:
Customize your author.php
file in theme directory and show specific information.
In this file, you can get any of information a user has.
To get a user's display-name, simply use <?php the_author_meta('display_name' ); ?>
Or to get his first name, use <?php the_author_meta('first_name' ); ?>
I would do it slightly different. I have a similar case but I created a custom post type with a full custom structure on the profile of that user. Using ACF, I linked the user account to the post in the custom post file. That way you have full control over how the user profile is structured and whatever fields are needed.
本文标签: pagesUser profile in frontend
版权声明:本文标题:pages - User profile in front-end 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736289561a1928330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
<?php global $current_user; var_dump($current_user); ?>
. For example:<?php the_author_meta( 'first_name', $current_user->ID ); ?>
. – Mayeenul Islam Commented Dec 7, 2015 at 11:14