How to display MyAccount navigation menu?
-
Hey,
I’m trying to find either a function (or shortcode) to display the My Account navigation menu items in a place where I like (outside of the usual myaccount template).
This is mainly for an optimised mobile navigation interface, so I just need a single call to display the my account menu items.
Can anyone tell me how to do this?
<a
<?php if(!is_user_logged_in()) {
echo 'href="'.wc_get_page_permalink('myaccount').'" ';
} else {
echo 'href="#collapseAccountMenu" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="collapseAccountMenu" ';
} ?>
class="btn btn-link btn-lg text-capitalize text-decoration-none fs-3 px-0"
>
<span class="fa-solid fa-user fa-lg"></span>
<?php if(!is_user_logged_in()) { ?>
Sign in / Register
<?php } else if(isset(get_userdata(get_current_user_id())->first_name)) {
echo 'Hi, '.get_userdata(get_current_user_id())->first_name.'! <span class="fa-solid fa-caret-down fa-fw"></span>';
} else {
echo 'Welcome back! <span class="fa-solid fa-caret-down fa-fw"></span>';
} ?>
</a>
<div class="collapse" id="collapseAccountMenu">
<p>Collapsed User Menu here...</p>
</div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘How to display MyAccount navigation menu?’ is closed to new replies.