Storefront is a nice and clean WooCommerce theme.
The theme has lots of hooks that you can find on Storefront Hooks page.
You can use this snippet to include any text at the top of the site. The code below captures the content and outputs it.
This should work for Storefront child themes well. Hopefully, whoever customized the theme(s) kept the hooks.
<?php
add_action('storefront_content_top', 'orb_blog6506_storefront_content');
/**
* Author Svetoslav Marinov
* <a href='https://orbisius.com/6506' target='_blank'>https://orbisius.com/6506</a>
*/
function orb_blog6506_storefront_content() {
ob_start();
?>
<div style='background:#037fbc; color:#fff; border:3px dashed;padding:5px; margin:10px 0;'>
We are running a promo.
<a style='color:#fff; font-weight:bolder;'
href='/contact/' target='_blank'>Contact us</a> for more info.
</div>
<?php
$buff = ob_get_clean();
$buff = trim($buff);
echo $buff;
}
Why / Benefits
The benefits of this global message are.
- Users are informed about promotions and deals.
- If you need to tell them something important and want to make sure they 100% read it.
- You can put a message to contact you if there's a product recall
- What other use cases do you see?
Image Credit: Artem Gavrysh (@tmwd), image id: F6-U5fGAOik on Unsplash
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer