html - PHP Display None? -


i'm trying hide "topbar" if user logged in. example: http://prntscr.com/chcwhl

my code @ moment is:

add_filter( 'wp_nav_menu_items', 'woohoo_add_auth_links', 10 , 2 ); function woohoo_add_auth_links( $items, $args ) {     if( $args->theme_location == 'topmenu' )     {         if ( is_user_logged_in() ) {             echo '<style>#topbar { display:none;}</style>';         }         elseif ( !is_user_logged_in() ) {             $items .= '<li><a href="'. site_url('wp-login.php') .'">log in</a></li>';             $items .= '<li><a href="'. site_url('wp-login.php?action=register') .'">register</a></li>';         }     }     return $items; } 

i'm sure topbar <div class="topbar"> i'm little confused why it's not hiding...

the # means id. can fix either using:

<div id="topbar"> 

or:

echo '<style>.topbar { display:none;}</style>'; 

a # css id, , . css class.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -