WordPress front end user center often used data and access methods

In the development of ordinary WordPress theme, we have ready-made theme can refer to, but the development of WordPress front-end user center, we are not easy to find a reference, probably because WordPress front-end user center needs no common theme The This article will introduce some of the development of WordPress front-end user center users often to some data acquisition method.

Global variables:

  1. $authordata
  2. $post
  3. $wp_query

Get the author archive page link

  1. echo get_author_posts_url( $authordata->ID );

Get the author’s nickname

  1. echo esc_attr( $authordata ->display_name )

Get the number of comments, use in loop:

  1. echo $post->comment_count

Get comment link, loop use:

  1. comments_link()

Get the current login user information

  1. $current_user = wp_get_current_user();

Gets the user information that needs to be operated

  1. global $wp_query;
  2. $author = $wp_query->get_queried_object();

Above is the development of front-end user center wordpress time often used in some of the data acquisition method, of course, this is only part of which I will be in the development of front-end user center when the accumulation gradually added for your reference.