User profiles come standard with some necessary fields like name, email, website, and biographical information. But sometimes, you need a bit more in this social-media-driven world.
This simple-to-use WordPress plugin adds the most common social-media sites to your user profile settings so that you can link readers to your social pages with ease. And, it is completely up to you to style it.
Here is how it works.
Once installed and activated, the plugin will add optional social fields to your user profile. For those you wish to be available to the public, simply provide the URL in the field next to the appropriate social-media site.
Then, using WordPress shortcode, you can display the social-media web site links virtually anywhere your WordPress theme allows text. For instance, if you want your user social fields to appear at the bottom of your post, copy and paste the following shortcode into your post body: [userfields]
.
When previewing the post, you will notice the user social fields listed as links exactly where you pasted the shortcode. By default, the shortcode will display the user social fields for the post or page author.
User Social Field Options
You can customize what the User Social Field shortcode will display by utilizing the following options:
Specify User. By default, the shortcode will find social fields for the author of the current post or page. If you wish to specify a particular user, add the “user” option and assign either the username or id as the value.
[userfields user="johndoe"]
[userfields user="12"]
Specify Fields. By default, the shortcode will find all available fields set in the user profile. Empty fields are ignored. If you wish to show specific fields (assuming they are set by user), add the “field” option and assign the specific social-media web sites divided by commas.
[userfields fields="facebook,instagram"]
Order Fields. By default, the fields are ordered alphabetically. However, it will order the fields according to the order you set the “fields” attribute in the shortcode.
[userfields fields="twitter,instagram,youtube"]
Using Shortcode in Templates
While [userfields] works in the body of your content and text widgets, it will not work in your theme template files. Rather, WordPress requires it to executed in its “do_shortcode()” function. (All options apply.)
<?php echo do_shortcode('[userfields]'); ?>
Styling Instructions
When the fields are displayed on your website, they are equipped with classes ready for you to style to your heart’s content. Here is the dom structure and class names:
ul.userfields ul.userfields > li.userfield a ul.userfields > li.userfield.userfield-twitter
Available Social-Media Fields
At the current stable release of the plugin, the following social-media fields are available on activation:
- Flickr
- Google Plus
- Tumbler
- Vimeo
- Vine
- YouTube