Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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' );
@abi145
Copy link

abi145 commented Oct 27, 2019

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