• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

The Cre8tive Diva - WordPress Developer

Digital Nomad | Helping WordPress & Genesis Framework Website Owners All Over the World

  • Home
  • About
    • Terms of Service & Privacy
    • Accessibility
  • Services
    • Pre-Made Genesis Theme Installation & Customization
    • Same Day Installation Service
    • Blogger to WordPress Migration
    • Buddypress Installation
  • My Work
  • Blog
    • Tutorials
    • Five on Friday
    • Genesis Framework
    • Tipsy Tuesday
    • WordPress
  • Contact
    • Support
  • Shop
  • 0 items$0.00

Published on: July 12, 2016

Add a Sales Banner Widget Area to Your WooCommerce Shop Using Genesis

FacebookTweetPinPrintShares2

A few nights ago I was in one of the developer groups and a member asked me if I could assist them with adding a widget area on the Shop pages of a WooCommerce project.

2016-07-12_16-22-14

Below is the code and instructions on how I did that.

If you are unfamiliar with working with your theme files, stop and ask for help. If you are familiar with modifying your theme files – you should back them up before proceeding.

Please note the location/position I have used is below the Primary Nav (or Secondary Nav depending on your theme). If you want to move it to a different location, check out the Genesis Visual Hook guide.

To Add a Widget Area on All Shop Pages

If you would like to add one widget area to display on All Shop Pages, click “View Raw” in the bottom right of the code box below. Then copy/paste the following code into your functions.php file. Make sure you hit “Enter” to begin a new line.

//* Register the WooCommerce Shop Banner Widget Area on All Shop Pages
genesis_register_sidebar( array(
'id' => 'woocommerce-shop-banner',
'name' => __( 'WooCommerce Shop Banner', 'themename' ),
'description' => __( 'This is the WooCommerce shop banner widget area.', 'themename' ),
) );
//* Hook WooCommerce Shop Banner Widget on All Shop Pages
add_action( 'genesis_before_content_sidebar_wrap', 'c8d_before_shop_content' );
function c8d_before_shop_content() {
if ( is_woocommerce() ) {
genesis_widget_area( 'woocommerce-shop-banner', array(
'before' => '<div class="woocommerce-shop-banner" class="widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
}
view raw functions.php hosted with ❤ by GitHub

To Add a Widget Area on Product Categories Only

If you would like to add one widget area to display on Product Categories Only, click “View Raw” in the bottom right of the code box below. Then copy/paste the following code into your functions.php file. Make sure you hit “Enter” to begin a new line.

//* Register the WooCommerce Shop Banner Widget Area on Product Categories Only
genesis_register_sidebar( array(
'id' => 'woocommerce-shop-banner',
'name' => __( 'WooCommerce Shop Banner', 'themename' ),
'description' => __( 'This is the WooCommerce shop banner widget area.', 'themename' ),
) );
//* Hook WooCommerce Shop Banner Widget on Product Categories Only
add_action( 'genesis_before_content_sidebar_wrap', 'c8d_before_shop_content' );
function c8d_before_shop_content() {
if ( is_product_category() ) {
genesis_widget_area( 'woocommerce-shop-banner', array(
'before' => '<div class="woocommerce-shop-banner" class="widget-area"><div class="wrap">',
'after' => '</div></div>',
) );
}
}
view raw functions2.php hosted with ❤ by GitHub

You can also add the widget area to single products, a specific category, a combination of categories or by using one of the other WooCommerce Conditional Tags.

You can see how it looks on all Shop pages here on the demo.

 

Did you find this blog or tutorial helpful?
Buy Me a Coffee at ko-fi.com
Like my Signature? Get the Signature Widget for Genesis right here!

Filed Under: Genesis Framework, Tutorials, WooCommerce Tagged With: customization, ecommerce, how-to, online stores, shop

Primary Sidebar

Sign Me Up!

Receive my blog posts, tips and updates delivered to your inbox!

Yes, Sign Me Up

*By signing up you will receive new blogs, updates on products, services and important alerts.

Categories

  • Design
  • eCommerce
  • Five on Friday
  • Fonts
  • Free Themes
  • Freebie Friday
  • Genesis Framework
  • Genesis Plugins
  • Genesis Themes
  • Genesis Untapped
  • Instagram
  • MailChimp
  • News
  • Plugins
  • Press This News
  • Promotions
  • Social Media
  • Tipsy Tuesday
  • Troubleshooting
  • Tutorials
  • Uncategorized
  • Web Development
  • WooCommerce
  • WordPress
  • WordPress Plugins

Footer

Digital Nomad! I can be anywhere I wanna be now.

  • Facebook
  • Google+
  • RSS
  • Twitter

Latest Blog Posts

  • #BlackFriday Save up to 75% on New Hosting
  • Temporary Fix When Using Genesis Blocks Posts and Page Grid with Genesis Simple Share
  • How to Add Reading Time to a WordPress Genesis Child Theme Without a Plugin

Looking for Something?

Copyright © 2012–2021 · Designed with by Me! · Hosted on SiteGround