Hi,
I want to show a status like “Welcome USERNAME” in the upper right side of header.
I add the following code on header.php and display status. Now how can I show this at right?
<?php
if ( is_user_logged_in() ) {
$user = wp_get_current_user();
echo “Welcome $user->display_name”;
}
?>
Regards.
Hey bilgecelik,
You could create a shortcode and place the shortcode in the Enfold Theme Options > Header > Extra Elements > Phone Number or small info text.
Try adding this code to the end of your functions.php file in Appearance > Editor:
// Add Shortcode to show user logged in
function user_logged_in() {
if ( is_user_logged_in() ) {
global $current_user; get_currentuserinfo();
echo 'Welcome ' . $current_user->user_login . " ";
};
}
add_shortcode( 'user_logged_in', 'user_logged_in' );
then add this shortcode to Phone Number or small info text field:
[user_logged_in]
Best regards,
Mike
Hi,
Even though I added this shortcode to phone Number or small info text field with display in top bar at the right choice, “welcome admin” is still at left.
I want to display it at right side of header.
Best regards,
Hi,
Try this code in the General Styling > Quick CSS field:
.av_phone_active_right.av_extra_header_active .container {
float: right !important;
width: 250px !important;
}
Best regards,
Mike
Hi,
It’ s ok.
Thanks for your help.
Best regards.
Hi,
Glad we were able to help, we will close this now. Thank you for using Enfold.
For your information, you can take a look at Enfold documentation here
And if there are features that you wish Enfold had, you can request them and vote the requested ones here
For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)
Best regards,
Mike