Login and Logout Modal button add in Navwalker

I have a problem. My site is one page template and its looking nice. I have added navwalker and it looks nice and working dynamically. But the problem is in my now I have added login and logout modal button and its have modal trigger and PHP code also. Now question is How can I login, logout using in navwalker?

Static Code:

<div id="navbar" class="navbar-collapse collapse">
    <ul id="top-menu" class="nav navbar-nav navbar-right main_nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#service">Services</a></li>
        <li><a href="#contact">Contact Us</a></li>
        <li><a href="" data-toggle="modal" data-target="#1myModal">Join Now</a></li>
        if ( is_user_logged_in() ) {
        $current_user = wp_get_current_user();
        <li><a href="<?php echo wp_logout_url( home_url() ); ?>">Log out</a></li>
        } else {
        <li><a href="" data-toggle="modal" data-target="#2myModal">Log In</a></li>


Read more here: Login and Logout Modal button add in Navwalker

Leave a Reply

Your email address will not be published. Required fields are marked *