Last active
July 11, 2021 18:11
-
-
Save Nikschavan/37fec2475282e2c714edece55206cfbc to your computer and use it in GitHub Desktop.
Astra Theme wrappers for the WooCommerce sensei
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
<?php // don't copy this line to your file. | |
// disable the default wrappers for the WooCommerce Sensei templates. | |
global $woothemes_sensei; | |
remove_action( 'sensei_before_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper' ), 10 ); | |
remove_action( 'sensei_after_main_content', array( $woothemes_sensei->frontend, 'sensei_output_content_wrapper_end' ), 10 ); | |
/** | |
* Load the correct wrappers for the WooCommerce Sensei layouts. | |
*/ | |
function astra_child_sensei_wrapper_start() { | |
$site_sidebar = astra_page_layout(); | |
if ( 'left-sidebar' == $site_sidebar ) { | |
get_sidebar(); | |
} | |
?> | |
<div id="primary" class="content-area primary"> | |
<?php astra_primary_content_top(); ?> | |
<main id="main" class="site-main" role="main"> | |
<div class="ast-lifterlms-container"> | |
<?php | |
} | |
function astra_child_sensei_wrapper_end() { | |
?> | |
</div> <!-- .ast-lifterlms-container --> | |
</main> <!-- #main --> | |
<?php astra_primary_content_bottom(); ?> | |
</div> <!-- #primary --> | |
<?php | |
$site_sidebar = astra_page_layout(); | |
if ( 'right-sidebar' == $site_sidebar ) { | |
get_sidebar(); | |
} | |
} | |
add_action('sensei_before_main_content', 'astra_child_sensei_wrapper_start', 10); | |
add_action('sensei_after_main_content', 'astra_child_sensei_wrapper_end', 10); | |
/** | |
* Declare support for the WooCommerce Sensei | |
*/ | |
function astra_child_declare_sensei_support() { | |
add_theme_support( 'sensei' ); | |
} | |
add_action( 'after_setup_theme', 'astra_child_declare_sensei_support' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment