Užitečné pluginy, návody a šablony pro WordPress CMS

Jak přidat vlastní pole do uživatelského profilu a zobrazit je na stránce

This technique will allow you to easily add new user profile fields that your blog’s users can use to input more information about themselves. In this tutorial, I’ll show you how to add an input box for a Twitter username and how to display it on your site.

In this article we will show you how you can create a contributors page which will display a list of authors with avatars or userphoto and any other information that you like.

The user profile of WordPress can be fairly easily adapted to add your own values​​. So you can add the necessary custom fields according to your requirements. Here is how you do it.

Most free themes do not have a custom author.php file, WordPress automatically callback to archive.php or index.php when someone views the author profile page. The problem with that is that it will only list all the posts written by the author, and it provides no personal information about the author. It is recommended that you copy your archive.php and save it as author.php and modify it.

To get user's (author's) data from his/her profile, use get_userdata function:

<?php
      $user_info = get_userdata($userid);
      $first_name = $user_info->first_name;
      $last_name = $user_info->last_name;
      $email = $user_info->user_email;
      $description = $user_info->description;
      $roles = $user_info->roles;
      $username = $user_info->user_login;
?>

obdobně funkce get user by.

OVX.cz 2003 | Přihlásit se
Bez cookies už dnes těžko provozovat plnohodnotný web. Setrváním zde tudíž vyjadřujete souhlas s jejich používáním. Více informací. | Zavřít.