Forked from AlphaBlossom/remove-woocommerce-admin-theme-support-warning.php
Created
September 17, 2018 11:09
-
-
Save BrunoBoehm/9d597b8f5356759d9b4e1444602bc133 to your computer and use it in GitHub Desktop.
Integrate WooCommerce into Genesis Child Theme
This file contains hidden or 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
// Remove WooCommerce Theme Support admin message | |
add_theme_support( 'woocommerce' ); |
This file contains hidden or 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
/********************************** | |
* | |
* Integrate WooCommerce with Genesis. | |
* | |
* Unhook WooCommerce wrappers and | |
* Replace with Genesis wrappers. | |
* | |
* Reference Genesis file: | |
* genesis/lib/framework.php | |
* | |
* @author AlphaBlossom / Tony Eppright | |
* @link http://www.alphablossom.com | |
* | |
**********************************/ | |
// Add WooCommerce support for Genesis layouts (sidebar, full-width, etc) - Thank you Kelly Murray/David Wang | |
add_post_type_support( 'product', array( 'genesis-layouts', 'genesis-seo' ) ); | |
// Unhook WooCommerce Sidebar - use Genesis Sidebars instead | |
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 ); | |
// Unhook WooCommerce wrappers | |
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 ); | |
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 ); | |
// Hook new functions with Genesis wrappers | |
add_action( 'woocommerce_before_main_content', 'youruniqueprefix_my_theme_wrapper_start', 10 ); | |
add_action( 'woocommerce_after_main_content', 'youruniqueprefix_my_theme_wrapper_end', 10 ); | |
// Add opening wrapper before WooCommerce loop | |
function youruniqueprefix_my_theme_wrapper_start() { | |
do_action( 'genesis_before_content_sidebar_wrap' ); | |
genesis_markup( array( | |
'html5' => '<div %s>', | |
'xhtml' => '<div id="content-sidebar-wrap">', | |
'context' => 'content-sidebar-wrap', | |
) ); | |
do_action( 'genesis_before_content' ); | |
genesis_markup( array( | |
'html5' => '<main %s>', | |
'xhtml' => '<div id="content" class="hfeed">', | |
'context' => 'content', | |
) ); | |
do_action( 'genesis_before_loop' ); | |
} | |
/* Add closing wrapper after WooCommerce loop */ | |
function youruniqueprefix_my_theme_wrapper_end() { | |
do_action( 'genesis_after_loop' ); | |
genesis_markup( array( | |
'html5' => '</main>', //* end .content | |
'xhtml' => '</div>', //* end #content | |
) ); | |
do_action( 'genesis_after_content' ); | |
echo '</div>'; //* end .content-sidebar-wrap or #content-sidebar-wrap | |
do_action( 'genesis_after_content_sidebar_wrap' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment