Use this code bellow:
<?php if ( is_user_logged_in() ) : ?>
<li> <a href="https://wordpress.stackexchange.com/questions/269073/<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a></li>
<?php else : ?>
<li> <a href="http://your-site-name/login/">Login</a></li>
<?php endif;?>
UPDATE
<?php if ( is_user_logged_in() ) :
$current_user = wp_get_current_user();
?>
<li> <a href="https://wordpress.stackexchange.com/questions/269073/<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a></li>
<li>Username: <?php echo $current_user->user_login; ?></li>
<?php else : ?>
<li> <a href="http://your-site-name/login/">Login</a></li>
<?php endif;?>
Related Posts:
- Check if user is logged in using JQuery
- jQuery AJAX form validation
- Making the wordpress login form a jQuery dropdown
- Trouble with WordPress Ajax Login System – 302
- SSL issues with WordPress site
- timeouts (ERR_CONNECTION_RESET) on seemingly random files after upgrading to HTTPS
- Can user meta be shown or hidden depending on user logged in status?
- animate.style on wp-login.php
- how to do display: block after user login
- wp_signon not working fine and 302 moved temporarily?
- jQuery equivalent of JavaScript’s addEventListener method
- How to send multiple data fields via Ajax?
- Adding an onclick function to go to url in JavaScript?
- Checking a Url in Jquery/Javascript
- When and why to ‘return false’ in JavaScript?
- Jquery Ajax Posting JSON to webservice
- How can I display a tooltip message on hover using jQuery?
- How is JavaScript .on() method defined?
- JQuery: $.get is not a function
- Bootstrap carousel not sliding
- How can I expand and collapse a using javascript?
- jQuery: using a variable as a selector [duplicate]
- Slide right to left?
- jQuery – checkbox enable/disable
- How can I correctly format currency using jquery?
- How do I send this form's output to a new WordPress page?
- Annoying “JQMIGRATE: Migrate is…” in console after update to WordPress 4.5
- Can’t get a JSON object in response to an Ajax request with wp_ajax
- Using the WordPress Media Library and returning the Attachment ID rather than URL?
- How to get a jQuery script to run on a page?
- WP set auth cookie using Ajax is not saved to browser
- Best approach for loading a sidebar Only if the screen max-width is >900px?
- Localize variable for multiple Shortcodes
- ajax call in wordpress front end
- Enqueuing jQuery in plug-ins
- Script doesn’t load because of a javascript MIME type error
- javascript is not working on Event Submission?
- TinyMCE – TypeError: r is undefined
- WordPress audio player causing js error, mediaelementplayer is not a function
- Auto-detect javascript errors and warn theme user
- Heartbeat API: How to access data already enqueued?
- Script for initializing JQuery Masonry for WordPress
- Combining media queries with image sizes
- Implementing lazy loading in homepage posts instead of pagination
- Jquery integration with my theme
- How to stop focus() in custom js from scrolling to footer?
- Is it possible to hide media details sidebar when wp.media popup is being opened?
- Getting post meta in the flex slider
- Correct way to write jQuery functions in WordPress
- Format numeric symbols in titles
- How can I make this custom menu work?
- Remove WordPress scripts
- Using bootstrap-slider and bootstrap-switch in wordpress admin panel
- WordPress jquery files not being enqueued
- Why does javascript works only if logged in?
- Load the next posts ajax
- How does WordPress handle HTML Tables interaction with jQuery
- what’s the best way to add a class to the div with a class of post every 4 seconds using jquery? [closed]
- Why Won’t my jQuery Play Nice with WordPress?
- Delete some text and change html tag with Jquery
- Callback After WordPress Customizer Complete Loading
- Showing All the Posts in the Loop
- How to enque js script in footer that are not in .js file?
- Best way of getting a a series of custom fields into an array?
- Cherry Framework theme, JQuery is using HTTP not HTTPS
- Custom AJAX form not working async
- Is there a default way in wordpress to create a overlay in the dashboard?
- Is it OK combined wp-include js, jquery, css? [closed]
- Including Older Version of jQuery for IE7/IE8
- Why won’t the Jquery validation plugin work?
- enqueue jQuery into the footer
- Jquery not working
- Query String Link With Anchor Tag Not Working on Same Page
- jQuey Popup no longer working
- Is textarea always accesible throught textarea#content in wordpress dashboard for a specific page?
- jQuery Datepicker displays wrong language until interection with the calendar
- Theme customisation – how to store javascript externally when it utilises php variables?
- How to pull data from a table using wpdb?
- Modify the href attribute of tag dynamically in WordPress
- Move jQuery on *top* of footer
- JQuery and Javascript to pan image
- How to add JS snippet before closing tag?
- Show/Hide text after the first paragraph
- Call admin ajax using absolute url? Relative URL breaks (frontend ajax)
- Responsive framework – edit child js
- Page keeps refreshing with Ajax form
- Check with jQuery value of checkbox from custom admin panel
- jquery issue in functions.php
- JS plugin script loading but not working
- WP Calendar Shortcode not working on my theme
- Hide input field when second input field is in focus
- Is it possible to append an external html file to my wordpress navigation?
- jscrollpane problem with my child theme
- Change image on post title hover (more than one instance) – Jquery
- How to fire jQuery after $(window).on(‘load’)
- I need a Pop up with description when i click an image
- My website si Blocked by google and warns the visitors that is Unsafe site
- how to make this work with jquery 1.12.4 [closed]
- Generate dynamic ID’s for each accordion button
- Impossible to update jQuery version from 3.1.0