First of all, please look at this question.
https://toolset.com/forums/topic/show-wpv-user-attributes-in-author-php-when-users-havent-got-any-post/#post-228064
I would like to realize the same thing without writing PHP.
Even if there is no posting, I would like to post the author 's profile on the author page.
How can I do it?
There's not currently a way to accomplish this without adding some custom code. The shortcodes provided in the other ticket are designed to allow you to access the user's information even when he or she has not published any posts. Once you copy + paste the PHP into a functions.php file, you can use the shortcodes in your templates.
Thank you Christian!
I want to use "WordPress Archive".
Can I use this short code in WordPress Archive for authors?
Or should I just use this in author.php?
Yes, you can use these shortcodes in a WordPress Archive of "Authors", that should be fine.
Thank you Christian !!!
Since I want to show it concretely, can you issue a private ticket?
I will tell you the URL of the site and login information.
I am in a hurry.
Reply from people other than Christian is okay.
Private reply is enabled here.
I wrote like this in functions.php
//SHORTCODE FOR USER ROLE
add_shortcode('get_user_role', 'get_user_role_func');
function get_user_role_func(){
global $wp_query;
$user = $wp_query->get_queried_object();
$arr = array();
if ( !empty( $user->roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
$arr[] = $role;
}
$res = implode(', ', $arr);
return $res;
}
//SHORTCODE FOR USER DISPLAY NAME
add_shortcode('get_user_display_name', 'get_user_display_name_func');
function get_user_display_name_func(){
global $wp_query;
$current_author = $wp_query->get_queried_object();
$author_display_name='';
if (is_object($current_author)) {
if (isset($current_author->data->display_name)) {
$author_display_name=$current_author->data->display_name;
}
}
return $author_display_name;
}
Where on WordPress Archive should I write this short code?
[wpv-no-items-found]
[wpml-string context="wpv-views"]There are no posts for this user[/wpml-string]
[/wpv-no-items-found]
Will this work?
[wpv-no-items-found]
[wpml-string context="wpv-views"]There are no posts for this user[/wpml-string]<br />
User role: [get_user_role]<br />
Display name: [get_user_display_name]
[/wpv-no-items-found]
I'm not able to see the login page at wp-admin, I see an error in Japanese:
WordPress管理画面へのアクセスが拒否されました
ただいまエックスサーバーのセキュリティ対策により、
一部のご利用環境からWordPress管理画面へのアクセスが制限されています。
お客様のご利用環境において本画面が表示されてしまう場合は、
サーバーパネル内[WordPressセキュリティ設定]より、制限の解除を行うことが可能です。
解除方法についてご不明な場合は、
本ページのURLまたは、アクセスされたWordPressのURLをお書き添えのうえ、
下記リンクより、エックスサーバーカスタマーサポートまでご連絡をお願いいたします。
エックスサーバーお問い合わせ窓口
サポートマニュアル - WordPressセキュリティ設定
【ご確認ください】
CloudFlare(クラウドフレア)等、外部サーバーを経由してアクセスされるサービス利用をされている場合、
お客様(閲覧者)のご利用環境ではなく、経由する外部サーバーが制限に該当している可能性があります。
この場合も、サーバーパネル内の[WordPressセキュリティ設定]より解除を行ってください。
I'm sory.
I changed the setting.
You can log in.
>Will this work?
I tried that, but it seems that information can not be acquired and displayed.
I wrote that short code at the head of "Filter Editor" of "WordPress Archive".
That's strange, the same code works perfectly for me on a basic site installation. I'm attaching a screenshot. I am curious to see if something else is causing interference. As a test, please temporarily disable all non-Toolset plugins and activate a default theme like Twenty Seventeen. Copy the shortcodes into the Twenty Seventeen theme. If the problem is resolved, then reactivate your plugins and theme one by one until the conflict is revealed. I will be happy to do this test for you if you approve.
Thank you! I was able to display username.
But,I can't display UserFields I add by Toolset.
Even if there is posting or not, how do I display them?
I would like to know how to create short codes to realize them and where to write in WordPress Archive.
Okay great! You can find information about displaying User fields here:
https://toolset.com/documentation/user-guides/displaying-wordpress-user-fields/
You can insert these fields using the Fields and Views button above a text editor.
With this method, User Data will not be displayed if there are no posts.
I am in trouble and I am in a hurry. I am sorry but I would like you to tell me specific examples
Sorry, I don't have a fast answer for this. As you can see, the other solutions have involved custom code. I can continue to work towards providing some more solutions, but it will take time. This feature is not built in to Toolset.