Created
January 5, 2019 08:58
-
-
Save Tsunamijaan/be1521f4179cf93bb948a2706bc8db78 to your computer and use it in GitHub Desktop.
If current user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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