WordPress front-end user center often used data and get method

In the development of ordinary WordPress themes, we have ready-made themes can be referred to, but the development of WordPress front-end user center, we are less likely to find a reference, probably because the demand for WordPress front-end user center is not as large as the ordinary theme. In this article, we will introduce some of the development WordPress Front End User CenterFrequent users to some methods of obtaining data.

global variable

$authordata
$post
$wp_query

Get a link to the author's archive page

echo get_author_posts_url( $authordata->ID ) ;

Get Author Nickname

echo esc_attr( $authordata ->display_name )

Get the number of comments, used in loop

echo $post->comment_count

Get comment link, used in loop

comments_link()

Get information about the currently logged in user

$current_user = wp_get_current_user();

Getting information about the user to be operated on

global $wp_query;
$author = $wp_query->get_queried_object();

The above is the development of the front-end user center often used in some of the data acquisition methods, of course, this is only part of it, I will gradually accumulate in the development of the front-end user center to add, for your reference.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *