-
AuthorPosts
-
April 6, 2017 at 6:25 pm #773383
Pretty much what the title says.
How can I change the secondary menu (login and registration) to show the state of the user?
Thanks
April 6, 2017 at 6:52 pm #773394Hey FlatText,
Please refer to the following thread:
https://kriesi.at/support/topic/show-logged-in-status-in-header/
Let me know if this works.
Best regards,
Jordan ShannonApril 7, 2017 at 1:56 pm #773970Hello,
header.php does not have that line. It’s in the helper-main-menu.php line 57.
When I do paste the is_user_logged_in snippet it’s not doing so correctly. See attached.
I would like the ‘welcome user’ message to hide the ‘Login’ ‘Registration’ links.
April 8, 2017 at 2:43 pm #774513Hi FlatText,
That code answered your original question. The other thing you want to do is a next question, now you have to check if user is logged in, hide the links and that already depends on how and where those links are added.
If you need help with that, please give us a link to your website, we need more context to be able to help you.If you need further assistance please let us know.
Best regards,
VictoriaApril 8, 2017 at 3:11 pm #774531Hi,
Thanks I sorted it out. For anyone who needs it, this is what I changed in /includes/helper-main-menu.php around line 42:
if(strpos( $headerS['header_secondary_menu'], 'extra_header_active') !== false ) { //display the small submenu if ( is_user_logged_in() ) { $user = wp_get_current_user(); $nav = "<div id='header-welcome'>Welcome <a href='wp-admin/profile.php'>". $user->display_name ."</a></div>"; //echo "<div id='header-welcome'>Welcome ". $user->display_name ."</div>"; } else { $avia_theme_location = 'avia2'; $avia_menu_class = $avia_theme_location . '-menu'; $args = array( 'theme_location'=>$avia_theme_location, 'menu_id' =>$avia_menu_class, 'container_class' =>$avia_menu_class, 'fallback_cb' => '', 'container'=>'', 'echo' =>false ); $nav = wp_nav_menu($args);} }
- This reply was modified 7 years, 8 months ago by FlatText.
April 8, 2017 at 3:16 pm #774534@flattext hopefully you made this changes in a child theme otherwise you will loose the customization with the next theme update
April 8, 2017 at 3:35 pm #774542Hi Max,
Yes, I made the changes to the child theme.
Thank you.
April 8, 2017 at 5:09 pm #774586 -
AuthorPosts
- The topic ‘Replace 'Login', 'Registration' in secondary menu with logged in username’ is closed to new replies.