Friends who use WordPress to build a website should know that WordPress itself does not have the function of uploading a user-defined avatar. If you want to change the avatar, the steps are very troublesome.
In our development of a WordPress theme, especially the multi-user theme, it is necessary for registered users to customize the upload of avatars. Can we add a user-defined upload function in the background of WordPress?
The answer is yes. Here are two user-defined ways to upload avatars.
1. Using the simple local avatars plugin
The webmaster can install it online in the background of WordPress – plugin – search plugin, and directly search the plugin simple local avatars. After it is enabled, he can set his avatar in the dashboard – user – my profile.
2. Pure code implementation
After downloading the simple local avatars plugin, we will find that the whole WordPress plugin is just a file. We can integrate the plugin into the WordPress theme, so that we can use one less plugin.
Plug in download:
link：https://pan.baidu.com/s/1ANon0CKNoOtd-Fhs-g-ldA Extraction code：ydeb
1. Unzip the downloaded compressed package to the theme directory, which is / WP content / themes / your theme/
2. And then in the functions.php Introduction:
//User defined avatar function include TEMPLATEPATH . '/extends/avatar/simple-local-avatars.php';
After completing the above steps, enter the website background – user – my personal data view, is there a custom upload avatar function?