function simple_shop_body_class($classes) { global $sds_theme_options, $content_width; // Simple Shop Customizer $simple_shop_customizer = Simple_Shop_Customizer_Instance(); // Content layout was specified by user in Theme Options if (isset($sds_theme_options['body_class']) && !empty($sds_theme_options['body_class'])) { // 1 Column if ($sds_theme_options['body_class'] !== 'cols-1') { $content_width = 950; } } // Page Template was specified by the user for this page if (!empty($sds_theme_options['page_template']) && $sds_theme_options['page_template'] !== 'default') { // Full Width or Landing Page if (in_array($sds_theme_options['page_template'], array('page-full-width.php', 'page-landing-page.php'))) { $content_width = 950; } } // Customizer if ($simple_shop_customizer->is_customize_preview()) { $classes['simple-shop-customizer'] = 'customizer'; } return $classes; }
/** * This function determines if the site is currently being previewed in the Customizer. */ public function is_customize_preview() { $simple_shop_customizer = Simple_Shop_Customizer_Instance(); $is_wp_4 = $simple_shop_customizer->version_compare('4.0'); // Less than 4.0 if (!$is_wp_4) { global $wp_customize; return is_a($wp_customize, 'WP_Customize_Manager') && $wp_customize->is_preview(); } else { return is_customize_preview(); } }