Skip to content

Instantly share code, notes, and snippets.

@ejntaylor
Last active October 2, 2015 01:36
Show Gist options
  • Save ejntaylor/5fd3b4efed3e9ce5c12b to your computer and use it in GitHub Desktop.
Save ejntaylor/5fd3b4efed3e9ce5c12b to your computer and use it in GitHub Desktop.
Add Canvas Business Slider to any page with any slide group
<?php
// Display the "Business" slider above the default WordPress homepage.
add_action( 'get_header', 'woo_custom_load_biz_slider', 10 );
function woo_slider_biz_new() {
$args = array(
'slide_page' => 394,
'use_slide_page' => true
);
woo_slider_biz($args);
}
function woo_custom_load_biz_slider () {
if ( is_shop() ) {
add_action( 'woo_main_before', 'woo_slider_biz_new', 10 );
//add_action( 'woo_main_before', 'woo_custom_reset_biz_query', 11 );
add_action( 'woo_load_slider_js', '__return_true', 10 );
add_filter( 'body_class', 'woo_custom_add_business_bodyclass', 10 );
}
} // End woo_custom_load_biz_slider()
function woo_custom_add_business_bodyclass ( $classes ) {
if ( is_shop() ) {
$classes[] = 'business';
}
return $classes;
} // End woo_custom_add_biz_bodyclass()
function woo_custom_reset_biz_query () {
wp_reset_query();
} // End woo_custom_reset_biz_query()
//* Add custom body class to the head
add_filter( 'body_class', 'sp_body_class' );
function sp_body_class( $classes ) {
if ( is_front_page() || is_shop() )
$classes[] = 'full-width full-slider';
return $classes;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment