If current user

<?php
global $current_user;
get_currentuserinfo();

if ($current_user->ID == '') { 
    //show nothing to user
}
else { 
    //write code to show menu here
}
?>

Live Demo:

<?php
	global $current_user;
		get_currentuserinfo();
	if ($current_user->ID == '') { 
	
	?>
		<?php
		
		$options = get_option( 'theme_settings' ); ?>
		
		<?php if($options['custom_profile']) { ?>
		<img src="<?php echo $options['custom_profile']; ?>" />
		
		<?php } else { ?>
		<?php echo get_avatar( get_the_author_email(), '50' ); ?>
		
		<?php } ?>
		
		<br/>
		
		<?php if($options['author']) { ?>
		<strong><?php echo $options['author']; ?></strong>
		<?php } else { ?>
		<strong>Welcome</strong>
		<?php } ?>
		
	<?php 
		
	}
	else { 
	?>
		<?php
			global $current_user;
			get_currentuserinfo();
				
				echo get_avatar( $current_user->ID, 50 );
		 ?><br/>
		 <strong>Hi  <?php global $current_user;
				get_currentuserinfo();
				echo ' ' . $current_user->user_login . "\n"; ?> </strong>
		
		<?php 
	}
?>

The following two tabs change content below.

Md Jahed

Latest posts by Md Jahed (see all)

Leave a Reply

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