wordpress soft exit  [ 722 views ]

Goal: after the exit link click keep the focus on blog page with a simple refresh.

The exit link is generated by wp_loginout();. Put the generated link into an identified container like this.

<li class="wpexit"><?php wp_loginout(); ?></li>

Catch the link object and override the click action (but only the logout action):

// exit link
$j('.wpexit a').on('click',function(){
  var h = ($j(this).attr('href'));
    callAjax(h, function(d){ location.reload(true); });
    return false;

callAjax = function(_url, _callback){
    url : _url,
    type : 'GET',
    success : function(data) {},
    error: function() {},
    complete: function(){ _callback && _callback();}

So the result is: when you click on the Log out link the process happening in the background and you can keep the current page after a simple refresh.

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }