• I would like to show the toolbar to all visitors of my site, with the exception of; not logged in users, while on the index page.

    The following placed in my function file works fine for displaying the toolbar to all visitors at all time.

    add_filter( 'show_admin_bar', '__return_true' );

    So I was hoping something like this could meet my added conditions…

    function show_bar() {
     	     if ( ! isset( $show_admin_bar ) ) {
     	          if ( ! is_user_logged_in() && is_home() ) {
     	               $show_admin_bar = __return_false;
     	          } else {
    	               $show_admin_bar = __return_true;	          }
    	     }
    
    $show_admin_bar = add_filter( 'show_admin_bar', '$show_admin_bar' );
    return $show_admin_bar;
    	}

    Unfortunately while it doesn’t blow anything up, it doesn’t display a toolbar for visitors on any page.

    My question is, Is there a better way to do this, if not, what do I need to do to get the function to work?

    thx

  • The topic ‘Do NOT show toolbar on specific page’ is closed to new replies.