Skip to content

Instantly share code, notes, and snippets.

@Tsunamijaan
Created January 5, 2019 08:58
Show Gist options
  • Select an option

  • Save Tsunamijaan/be1521f4179cf93bb948a2706bc8db78 to your computer and use it in GitHub Desktop.

Select an option

Save Tsunamijaan/be1521f4179cf93bb948a2706bc8db78 to your computer and use it in GitHub Desktop.
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
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment