Created
November 1, 2017 15:33
-
-
Save stuartduff/926f100ddc60cc3d5f0f7086ef547a02 to your computer and use it in GitHub Desktop.
Add a custom text element to the header configurator of Storefront Powerpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.