Thank you for your quick response.
I try to challenge coding.
Could you please tell me an example of PHP coding to display the User Field I added in the author's WordPress Archive without posting?
*
I can not use English and PHP well, so I am sorry to have troubled you.
Thank you very much, Christian.
It's no trouble 🙂
Here's a user meta shortcode:
add_shortcode( 'get_user_meta_no_posts', 'get_user_meta_no_posts_func' );
function get_user_meta_no_posts_func( $atts ) {
global $wp_query;
$current_author = $wp_query->get_queried_object();
$key = 'wpcf-' . $atts['key'];
$single = 1;
return get_user_meta($current_author->data->ID, $key, $single);
}
Use the shortcode like this:
[get_user_meta_no_posts key="user-meta-slug"]
Change "user-meta-slug" to the slug of the User field you would like to display. Please let me know if this works for you.
Thank you very much Christian!
I think that I can solve it soon!
There is one thing I want to ask.
Does this short code always display the value even if there is no posting?
I actually tried using it and did such a movement.
Yes, this code will display the value even if there are no posts by the author. It will only work on an author archive.