Hi there,
I have the following code for a WordPress menu that displays content when a user is logged in:
<?php if ( is_user_logged_in() ): $current_user = wp_get_current_user(); ?> <div class="user-profile-dropdown"> <a class="user-profile-name" href="#"> <div class="avatar"> <?php echo get_avatar( $current_user->ID ) ?> </div> <span> <span class="welcome d-block">Welcome, <?php echo esc_html( $current_user->display_name ) ?></span> My Account</span> <?php if ( class_exists('WooCommerce') ): ?> <div class="submenu-toggle"><i class="icons8-expand-arrow"></i></div> <?php endif; ?> </a> </div> <?php endif ?>
However, I would like to display some content for when the user is not logged in. I cannot work out how to do an else statement. on the above.
Can anyone help me in show some content when the user is not logged in/using an else statement?
Many thanks!