Skip to content

Instantly share code, notes, and snippets.

@woogist
Created November 25, 2014 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogist/23603cc309b601d3c131 to your computer and use it in GitHub Desktop.
Save woogist/23603cc309b601d3c131 to your computer and use it in GitHub Desktop.
Storefront top bar welcome message
<?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