Why use a shortcode instead of Welcome, <?php echo $current_user->display_name; ?>
@sterndata
Thanks for your reply. I really appreciate.
Now, How will this your code be applied? Or how will it be outputted?
I mean that I’m manually writing HTML in that particular spot,to display the specific logged in user’s display Name in that particular space, inside a Span or <P> Tag.
Will your code just natively output itself inside the HTML in that particular spot, without me needing to use a shortcode? — without me needing to do something else?
Or isn’t it in functions.php that I will insert the code? — then place an element somewhere to output it?
Perhaps I’m lost. Can you Please elaborate clearly and probably show me a demonstration of the code actually giving the desired result from your end?
Regards.
Shortcodes are intended for front end output. The are not expanded in the back end editor, or else no one would be able to edit it.
Why would you need to display the current logged in user name in the back end? It’s already displayed on every admin screen in the admin bar.
Regardless, if you want to do so, the way forward depends on where you want this to appear. If literally on the initial dashboard screen, you’ll either hook into an existing dashboard widget, or create your own.
For dashboard widgets, see the existing source code at /wp-admin/includes/widgets.php
I’ve gotten beautiful answers, but haven’t gotten any working solution.
Now, I’m using White Label CMS to personalize the WP Admin Dashboard for my client.
I’ve hidden most of the items on the WP Admin Dashboard in order not to confuse the client.
When he logs in to WP Admin, I want to greet him by his Display Name or Username, then leave him a set of guides on that WP Admin Dashboard, with some links that will help him do some things.
So the greeting is to say:
Welcome (display_name)
— Click Posts to create new Posts.
— Click “Add Product” to create new Products.
— Click “Product” to view all Products.
That’s what I need to do on the WP Admin Dashboard for the client, but I need to greet him personally and dynamically.
Dynamically, because they will be 3 people. And each one needs to be greeted by their display Name or Username.
I believe I’ve explained my Use Case clearly?
And now that I’ve clearly explained my exact Use case, can anyone help?
Regards.
I recommend asking at https://wordpress.org/support/plugin/white-label-cms/#new-post so the plugin’s developers and support community can help you with this.
Thank You for your suggestion. I have done as you suggested. See it here– https://prnt.sc/PYHUmyd16I0d
Regards.
To keep further replies in one place, this topic is closed.
Anyone following along may continue at:
https://wordpress.org/support/topic/shortcode-displayed-instead-of-username/