wc_register_sidebar(); $this->constants(); $this->theme_support(); $this->post_type_support(); } /** * Loads all the parent theme files * * @since 1.0.0 */ public function launch() { # Hook in before the action happens do_action( 'bizznis_pre_woocommerce_integration' ); # Stop here, if bizznis woocommerce integratin is not defined if ( ! current_theme_supports( 'bizznis-woocommerce' ) ) { return; } # Stop here, if woocommerce version is lower than 2.0.0 global $woocommerce; if ( version_compare( $woocommerce->version, '2.0.0', '<' ) ) { return; } # Environment is OK, let's go! global $woocommerce; # Load Functions if ( ! current_theme_supports( 'bizznis-woo-breadcrumbs') ) { load_template( BIZZNIS_WC_INC_DIR . '/breadcrumb.php' ); } load_template( BIZZNIS_WC_INC_DIR . '/template-loader.php' ); load_template( BIZZNIS_WC_INC_DIR . '/settings.php' ); # Take control of shop template loading remove_filter( 'template_include', array( &$woocommerce, 'template_loader' ) ); add_filter( 'template_include', 'bizznis_wc_template_loader', 20 ); } /** * Register forum specific sidebar if enabled * * @since 1.0.0 */ public function wc_register_sidebar() { # Register sidebar if option checked if ( bizznis_get_option( 'bizznis_wc_sidebar' ) ) { bizznis_register_sidebar( array( 'id' => 'sidebar-woocommerce', 'name' => __( 'Shop Sidebar', 'bizznis' ), 'description' => __( 'This is the primary sidebar used on all WooCommerce shop pages.', 'bizznis' ) ) ); } # Replace the primary sidebar add_action( 'bizznis_before', array( $this, 'check_wc_sidebar' ) ); } /** * Setup shop specific sidebar on bbPress pages if enabled * * @since 1.0.0 */ public function check_wc_sidebar() { if ( is_woocommerce() && bizznis_get_option( 'bizznis_wc_sidebar' ) ) { # Remove the default Bizznis sidebar remove_action( 'bizznis_sidebar', 'bizznis_do_sidebar' ); # Load up the WooCommerce sidebar add_action( 'bizznis_sidebar', array( $this, 'load_wc_sidebar' ) ); } } /** * Loads text instructions when shop specific sidebar is empty * * @since 1.0.0 */ public function load_wc_sidebar() { // Throw up placeholder content if the sidebar is active but empty if ( ! dynamic_sidebar( 'sidebar-woocommerce' ) && current_user_can( 'edit_theme_options' ) ) { bizznis_default_widget_area_content( __( 'Shop Sidebar Widget Area', 'bizznis' ) ); } } /** * Defines theme constants throughout the template * * @since 1.0.0 */ private function constants() { # Directory Locations define( 'BIZZNIS_WC_INC_DIR', BIZZNIS_INT_WC_DIR . '/inc' ); define( 'BIZZNIS_WC_TEMPLATES_DIR', BIZZNIS_INT_WC_DIR . '/templates' ); # URL Locations define( 'BIZZNIS_WC_INC_URL', BIZZNIS_INT_WC_URL . '/inc' ); define( 'BIZZNIS_WC_TEMPLATES_URL', BIZZNIS_INT_WC_URL . '/templates' ); } /** * Activates default theme features. * * @since 1.0.0 */ public function theme_support() { add_theme_support( 'woocommerce' ); add_theme_support( 'bizznis-woocommerce' ); } /** * Initialize post type support for Bizznis features (Layout selector, SEO, Scripts). * * @since 1.0.0 */ public function post_type_support() { add_post_type_support( 'product', array( 'bizznis-seo', 'bizznis-scripts', 'bizznis-layouts' ) ); } } /** * Launch the ingration class * * @since 1.0.0 */ add_action( 'after_setup_theme', 'bizznis_wc_integration' ); function bizznis_wc_integration() { $bizznis = new Bizznis_WC; #ready, set, go! $bizznis->launch(); }