Created
November 25, 2014 08:33
-
-
Save woogist/23603cc309b601d3c131 to your computer and use it in GitHub Desktop.
Storefront top bar welcome message
This file contains 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 | |
/** | |
* Adds a top bar to Storefront, before the header. | |
*/ | |
function storefront_add_topbar() { | |
global $current_user; | |
get_currentuserinfo(); | |
if ( ! empty( $current_user->user_firstname ) ) { | |
$user = $current_user->user_firstname; | |
} else { | |
$user = __( 'guest', 'storefront-child' ); | |
} | |
?> | |
<div id="topbar"> | |
<div class="col-full"> | |
<p>Welcome <?php echo $user ?>!</p> | |
</div> | |
</div> | |
<?php | |
} | |
add_action( 'storefront_before_header', 'storefront_add_topbar' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment