Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.