Header Menu link:- I have used many login and sign up plugin’s but they provide me only log in and sign up page to get register and logged in but once front end user logged in, it will not show “My Account” Option in menu, only the Login option there that I placed to get log in as a page, it does not change.
I want to get “My Account” option in menu so that the Log in option in menu will replace into My Account or in Front end user name once user logged in. And in My Account option there should be edit profile and View profile option.
How to get this feature via plugin installed. I am using Profile Builder plugin.
Help with WordPress 4.4.2 …
For replacing the LogIn button with the LogOut button you have to play a small trick. For this you have to follow the below steps:
a) Create a Menu for guest users who are not logged in yet.
b) Call the created menu in the if, else condition. Please see the below example for more clarification.
c) Copy the below code and use it. Please replace the Menu Name with your menu created in the admin panel.
<?php if(is_user_logged_in()) { ?>
<nav id=”primary-nav” role=”navigation” class=”clearfix”>
<ul class=”nav sf-menu clearfix sf-js-enabled”>
<li class=”btnclass menu-item menu-item-type-post_type menu-item-object-page menu-item-230”><a alt=”LogOut” href=”<?php echo wp_logout_url( ); ?>”>Log Out</a></li>
<li class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-229”><a class=”dropclass sf-with-ul” href=”#”>My Account <i class=”icon-angle-down”></i></a>
<ul style=”display: none; visibility: hidden;” class=”sub-menu”>
<li class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-230”><a href=”<?php echo site_url(); ?>/edit-profile”>Edit Profile</a></li>
<li class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-230”><a href=”<?php echo site_url(); ?>/my-account”>My Account</a></li>
<li class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-230”><a href=”<?php echo site_url(); ?>/ask-a-quote”>Ask a Quote</a></li>
</ul>
</li>
</ul>
</nav>
<?php } else { ?>
<nav id=”primary-nav” role=”navigation” class=”clearfix” style=”float:right;”>
<?php wp_nav_menu( array( ’container’ => ’ul’, ’menu_class’ => ’btnclass menu-item menu-item-type-post_type menu-item-object-page’, ’menu’ => ’Top Left Menu’ ) ); ?>
</nav>
<?php } ?>
Hope this will help you.
Let me know full procedure please because it is not working properly, I got some links with buttons in log in page along with log in details.
I created a Log In page and put all the code (that you sent) inside that page content. After this add Log In page in header menu. I clicked on Log In option from menu then it shows some links in that page like Log Out, My Account, Ask a Quote, Edit Profile but it did not work like other websites.
Did not get my account option in menu bar.
Kindly explain full procedure one by one
You have to create the functionality for that. I have just explained, how to shuffle the login and logout button with other required options.