Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartduff/926f100ddc60cc3d5f0f7086ef547a02 to your computer and use it in GitHub Desktop.
Save stuartduff/926f100ddc60cc3d5f0f7086ef547a02 to your computer and use it in GitHub Desktop.
Add a custom text element to the header configurator of Storefront Powerpack
// Adds the text element to the powerpack header components
function sp_header_components_custom_text( $components ) {
$components['text'] = array(
'title' => __( 'Custom Text', 'storefront-powerpack' ),
'hook' => 'sp_header_custom_text_output'
);
return $components;
}
add_filter( 'sp_header_components', 'sp_header_components_custom_text' );
// Adds text area output to the Storefront header
function sp_header_custom_text_output() {
echo '<div class="custom-text">';
echo 'Some custom text added to header in Storefront Powerpack';
echo '</div>';
}
add_action( 'storefront_header', 'sp_header_custom_text_output' );
@imabidin
Copy link

Hi, is there any chance to place a second custom header element? I tried to place this code two times with different function names, but it didn't work unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment