Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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?

    #530263

    Hey 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,
    Elliott

    #530740

    Thanks for that.

    Will it not be overwritten with the Enfold updates? Would you suggest a child theme?

    #530747

    Hi!

    Yes, it would be overwritten. Please use a child theme – http://kriesi.at/documentation/enfold/using-a-child-theme/

    Regards,
    Yigit

    #530774

    Thanks 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.
    #530789

    Well the child theme is somhow fixed (after updating plugins and refreshing), but if you can help position the Welcome message, it would be appreciated :)

    #531538

    Hi!

    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,
    Andy

    #532844

    Here you go..
    How it displays currently: http://screencast.com/t/9Wv05IZ2R
    The code: http://screencast.com/t/PddQTOQ1upw

    Its 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.

    #533473

    Hey!

    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!
    Elliott

    #534844

    Wonderful 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();?

    #534955

    Hey!

    Perhaps this would work.

    echo '<span>';
    wp_loginout();
    echo '</span>';
    

    Cheers!
    Elliott

    #535319

    Cheers! That worked fine!

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Welcome username / login / logout in top bar’ is closed to new replies.