Code Snippets

Add static content to the Storefront header

Adding static content to the Storefront header requires hooking a function that outputs your content into storefront_header.

You can control the position of the markup via the priority set. For example, the following snippet would add a ‘row’ between the site title / secondary navigation / search and the primary navigation.

add_action( 'storefront_header', 'jk_storefront_header_content', 40 );
function jk_storefront_header_content() { ?>
<div style="clear: both; text-align: right;">
Have questions about our products? <em>Give us a call:</em> <strong>0800 123 456</strong>

view raw


hosted with ❤ by GitHub

Tweak the priority and the inline CSS to meet your requirements.

We recommend adding snippets like this to your Theme Customization plugin to ensure that your custom code isn’t lost when you update Storefront or any Storefront Child Theme.