| 开发者 | dixitpujara |
|---|---|
| 更新时间 | 2026年9月7日 23:02 |
| PHP版本: | 7.2 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[dp_user_role_display] shortcode - every setting can be overridden per shortcode.dp-username-role-display folder to the /wp-content/plugins/ directory, or install the plugin through the Plugins > Add New screen in WordPress.Only logged-in users see their own username and role. Logged-out visitors see nothing.
The info is output using the wp_body_open hook, so it appears at the top of the page body. Most modern themes support this hook.
Yes. Go to Settings > User Info Settings and use the color pickers for the background, text, and label colors.
Yes. The User Label and Role Label fields on the settings page let you set any text you like (for example "Logged in as" or "Account").
The plugin includes 5 display templates that change how the info looks on the front end: a classic right-aligned bar, a full-width banner, a centered rounded pill, a minimal inline style, and an accent card. Pick one from the Display Template dropdown on the settings page.
Enable Show Profile Icon on the settings page and set the size (16-128 pixels). The plugin uses the standard WordPress avatar (get_avatar()), so it shows the same profile picture as elsewhere on your site.
Add [dp_user_role_display] to any post, page, or widget. With no attributes it follows your saved settings. You can override any of them per shortcode:
[dp_user_role_display template="3" avatar="yes" avatar_size="48" bg_color="#0d1b2a" text_color="#ffffff" label_color="#ffd60a" user_label="Logged in as" role_label="Access level"]
Available attributes: template (1-5), bg_color, text_color, label_color (hex colors), user_label, role_label (text), avatar (yes/no), avatar_size (16-128). The settings page also generates the shortcode for you as you change options.
Yes. The Enable Display toggle only controls the automatic block at the top of the page. The shortcode always renders for logged-in users, so you can turn off the automatic display and place the info exactly where you want it.
Yes. Spanish, French, German, Hindi, and Gujarati translations are bundled, and the plugin picks the right one automatically based on your site language. Every string is translation-ready, so any other language can be added via the included .pot template or translate.wordpress.org.
[dp_user_role_display] shortcode with per-shortcode overrides for template, colors, labels, and avatar.wp_body_open hook.