Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Created October 26, 2012 18:16
Show Gist options
  • Save themeblvd/3960433 to your computer and use it in GitHub Desktop.
Save themeblvd/3960433 to your computer and use it in GitHub Desktop.
If you're using the Theme Blvd Woo Commerce patch plugin, this is how you'd make the default sidebar layout full width.
/**
* Force WooCommerce full_width layout.
*/
function my_woocommerce_sidebar_layout( $sidebar_layout ){
global $post;
// Only run if WooCommerce plugin is installed
if( function_exists( 'is_woocommerce' ) ) {
// Figure out if this a static page we need force as a WooCommerce page.
$force_woocommerce = false;
if( is_page() ) {
$woocommerce_page = get_post_meta( $post->ID, '_tb_woocommerce_page', true );
if( $woocommerce_page === 'true' )
$force_woocommerce = true;
}
// Adjust sidebar layout if necessary.
if( is_woocommerce() || $force_woocommerce )
$sidebar_layout = 'full_width';
}
return $sidebar_layout;
}
remove_filter( 'themeblvd_sidebar_layout', 'tb_woocommerce_sidebar_layout' );
add_filter( 'themeblvd_sidebar_layout', 'my_woocommerce_sidebar_layout' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment