admin管理员组文章数量:1130349
After the user clicks on Log In, the Log In option changes to Log Out in the menu. How can I make it change to My Orders instead, redirecting to /my-account/orders/?
So basically now it's changing from:
<li class="menu-item"><a class="porto-link-login" href="/"><i class="fa fa-user"></i>Log In</a></li>
to:
<li class="menu-item"><a href="/"><i class="avatar"></i>Log out</a></li>
But I'd want it to change to:
<li class="menu-item"><a href="/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
After the user clicks on Log In, the Log In option changes to Log Out in the menu. How can I make it change to My Orders instead, redirecting to /my-account/orders/?
So basically now it's changing from:
<li class="menu-item"><a class="porto-link-login" href="https://website/my-account/"><i class="fa fa-user"></i>Log In</a></li>
to:
<li class="menu-item"><a href="https://website/my-account/customer-logout/"><i class="avatar"></i>Log out</a></li>
But I'd want it to change to:
<li class="menu-item"><a href="https://website/my-account/orders/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
Share
Improve this question
edited Nov 30, 2018 at 14:15
Robert Calceanu
asked Nov 30, 2018 at 9:40
Robert CalceanuRobert Calceanu
113 bronze badges
3
- not clear for me ? – vikrant zilpe Commented Nov 30, 2018 at 9:55
- Are you using any plugins? – Aravona Commented Nov 30, 2018 at 11:45
- Vikrant, I made it a bit more clear maybe. Lots of plugins yep. – Robert Calceanu Commented Nov 30, 2018 at 14:16
1 Answer
Reset to default 0You can work with is_user_logged_in() function to create a if / else statement in your menu.
Here a quick code.
<?php
if ( is_user_logged_in() ) {
?>
<li class="menu-item"><a href="https://website/my-account/orders/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
<li class="menu-item"><a href="https://website/my-account/customer-logout/"><i class="avatar"></i>Log out</a></li>
<?php
}
else {
?>
<li class="menu-item"><a class="porto-link-login" href="https://website/my-account/"><i class="fa fa-user"></i>Log In</a></li>
<?php
}
?>
You could also work with the current user capabilities current_user_can to create a better filter for your menus.
I will give you the documentation below if you want to go further.
Documentation : https://developer.wordpress/reference/functions/is_user_logged_in/ https://codex.wordpress/Function_Reference/current_user_can
After the user clicks on Log In, the Log In option changes to Log Out in the menu. How can I make it change to My Orders instead, redirecting to /my-account/orders/?
So basically now it's changing from:
<li class="menu-item"><a class="porto-link-login" href="/"><i class="fa fa-user"></i>Log In</a></li>
to:
<li class="menu-item"><a href="/"><i class="avatar"></i>Log out</a></li>
But I'd want it to change to:
<li class="menu-item"><a href="/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
After the user clicks on Log In, the Log In option changes to Log Out in the menu. How can I make it change to My Orders instead, redirecting to /my-account/orders/?
So basically now it's changing from:
<li class="menu-item"><a class="porto-link-login" href="https://website/my-account/"><i class="fa fa-user"></i>Log In</a></li>
to:
<li class="menu-item"><a href="https://website/my-account/customer-logout/"><i class="avatar"></i>Log out</a></li>
But I'd want it to change to:
<li class="menu-item"><a href="https://website/my-account/orders/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
Share
Improve this question
edited Nov 30, 2018 at 14:15
Robert Calceanu
asked Nov 30, 2018 at 9:40
Robert CalceanuRobert Calceanu
113 bronze badges
3
- not clear for me ? – vikrant zilpe Commented Nov 30, 2018 at 9:55
- Are you using any plugins? – Aravona Commented Nov 30, 2018 at 11:45
- Vikrant, I made it a bit more clear maybe. Lots of plugins yep. – Robert Calceanu Commented Nov 30, 2018 at 14:16
1 Answer
Reset to default 0You can work with is_user_logged_in() function to create a if / else statement in your menu.
Here a quick code.
<?php
if ( is_user_logged_in() ) {
?>
<li class="menu-item"><a href="https://website/my-account/orders/"><i class="fa fa-handshake-o"></i>My Orders</a></li>
<li class="menu-item"><a href="https://website/my-account/customer-logout/"><i class="avatar"></i>Log out</a></li>
<?php
}
else {
?>
<li class="menu-item"><a class="porto-link-login" href="https://website/my-account/"><i class="fa fa-user"></i>Log In</a></li>
<?php
}
?>
You could also work with the current user capabilities current_user_can to create a better filter for your menus.
I will give you the documentation below if you want to go further.
Documentation : https://developer.wordpress/reference/functions/is_user_logged_in/ https://codex.wordpress/Function_Reference/current_user_can
本文标签: logoutHow do I replace quotLog Outquot from the Menu with quotMy Ordersquot
版权声明:本文标题:logout - How do I replace "Log Out" from the Menu with "My Orders"? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749138116a2321719.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论