-
AuthorPosts
-
November 4, 2015 at 4:17 pm #530155
Hi there,
Before the e-commerce menu in the top bar right-side, I would like to add Welcome Visitor (if logged out) or Welcome First Name (if logged in) as well as the login/logout link.
How can I do that, or would I need to create a child theme for this?
November 4, 2015 at 5:27 pm #530263Hey drijen!
Please see here, https://codex.wordpress.org/Function_Reference/is_user_logged_in. It gives you the exact code needed.
If you want to add it around the header then your probably wanting to add it around line 135 in the /enfold/includes/helper-main-menu.php file.
Regards,
ElliottNovember 5, 2015 at 12:56 pm #530740Thanks for that.
Will it not be overwritten with the Enfold updates? Would you suggest a child theme?
November 5, 2015 at 1:07 pm #530747Hi!
Yes, it would be overwritten. Please use a child theme – http://kriesi.at/documentation/enfold/using-a-child-theme/
Regards,
YigitNovember 5, 2015 at 2:13 pm #530774Thanks for your prompt reply. I have created a child theme, and imported the settings from the parent Enfold theme.
However the colours have reverted back to the default green for some reason, despite the backend showing the correct colours in theme settings.
Also the Welcome registered user code is displaying, but I can’t get it to display exactly where I want it (just before the top bar menu). Could you help me out please? Details provided in the private content
- This reply was modified 9 years ago by drijen.
November 5, 2015 at 2:33 pm #530789Well the child theme is somhow fixed (after updating plugins and refreshing), but if you can help position the Welcome message, it would be appreciated :)
November 6, 2015 at 5:02 pm #531538Hi!
are you talking about “Welcome to Infinity Roof Lights”? if yes how do you want to position it? we can’t know it how you want it to look like, so please send us a mockup showing the result. You can use imgur.com or dropbox.
Regards,
AndyNovember 9, 2015 at 7:18 pm #532844Here you go..
How it displays currently: http://screencast.com/t/9Wv05IZ2R
The code: http://screencast.com/t/PddQTOQ1upwIts currently on the left (after the contact information) and i want it on the right , before the top menu. I think it can be achieved by floating it to the right. If you could tell me how I could wrap this in a div and add a class to it, I can style it.
November 10, 2015 at 5:22 pm #533473Hey!
You’ll need to surround it with a span or some other tag first so we can target it via CSS.
<?php if ( is_user_logged_in() ) { echo '<span class = "welcome-text">Welcome, registered user!</span>'; } else { echo '<span class = "welcome-text">Welcome, visitor!</span>'; } ?>
Cheers!
ElliottNovember 12, 2015 at 4:07 pm #534844Wonderful thanks!
I jsut need one final thing – so far I have entered this code:
global $current_user; get_currentuserinfo();
if ( is_user_logged_in() ) {
echo ‘<span class = “welcome-text”>Welcome ‘ . $current_user->user_login.”\n”; echo ‘! My Account | </span>’ ; wp_loginout();} else {
echo ‘<span class = “welcome-text”>Welcome, visitor!</span>’ ; wp_loginout();
}How would I put a span around wp_loginout();?
November 12, 2015 at 6:16 pm #534955Hey!
Perhaps this would work.
echo '<span>'; wp_loginout(); echo '</span>';
Cheers!
ElliottNovember 13, 2015 at 11:05 am #535319Cheers! That worked fine!
-
AuthorPosts
- The topic ‘Welcome username / login / logout in top bar’ is closed to new replies.