rebase from live enviornment

This commit is contained in:
Rachit Bhargava
2024-01-09 22:14:20 -05:00
parent ff0b49a046
commit 3a22fcaa4a
15968 changed files with 2344674 additions and 45234 deletions

View File

@@ -0,0 +1,131 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Avada theme
* @see https://avada.theme-fusion.com/
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_Avada {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ), 15 );
add_action( 'et_pb_shop_before_print_shop', array( $this, 'register_shop_thumbnail' ) );
add_action( 'et_builder_wc_product_before_render_layout_registration', array( $this, 'remove_builder_wc_product_elements' ) );
}
/**
* Adding patch for to fix module's output which is affected by JS-based modification
*
* @since ??
*/
function enqueue_scripts() {
// WooCommerce module can be used on all CPT, hence WooCommerce module fix should be
// available on any CPT. ET_Builder_Theme_Compat_Loader->has_theme_compat() already
// check whether pagebuilder is used or not
if ( et_is_woocommerce_plugin_active() && ! et_fb_is_enabled() ) {
wp_enqueue_script(
'et_pb_wc_theme_avada',
ET_BUILDER_PLUGIN_URI . '/theme-compat/js/avada-frontend-woocommerce.js',
array( 'fusion-scripts' ),
ET_BUILDER_VERSION,
true
);
}
}
/**
* Remove Avada's product thumbnail on shop module and add Divi's product thumbnail
* @since 1.3.10
* @return void
*/
function register_shop_thumbnail() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'avada_woocommerce_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
}
/**
* Remove unwanted WC products element added by theme; builder's WooCommerce module
* will render these element (if added to the layout)
*
* @since ??
*
* @return void
*/
function remove_builder_wc_product_elements() {
global $avada_woocommerce;
// Remove unwanted custom WooCommerce elements added by Avada
remove_action(
'woocommerce_single_product_summary',
array( $avada_woocommerce, 'template_single_title' ),
5
);
remove_action(
'woocommerce_single_product_summary',
array( $avada_woocommerce, 'stock_html' ),
10
);
remove_action(
'woocommerce_single_product_summary',
array( $avada_woocommerce, 'add_product_border' ),
19
);
// Remove related products element added by Avada on the bottom of page if builder
// is used on `product` page
remove_action(
'woocommerce_after_single_product_summary',
array( $avada_woocommerce, 'output_related_products' ),
15
);
// Remove sharing links added by Avada on the bottom of page if builder is used
// on `product` page
remove_action(
'woocommerce_after_single_product_summary',
array( $avada_woocommerce, 'after_single_product_summary' ),
15
);
}
}
ET_Builder_Theme_Compat_Avada::init();

View File

@@ -0,0 +1,74 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Betheme theme
* @see http://themes.muffingroup.com/betheme
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_Betheme {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'et_pb_shop_before_print_shop', array( $this, 'add_option_betheme_modification' ) );
}
/**
*
* @since 1.3.10
* @return void
*/
function add_option_betheme_modification() {
add_filter( 'option_betheme', array( $this, 'option_betheme_modification' ) );
}
/**
*
* @since 1.3.10
* @return void
*/
function option_betheme_modification( $options ) {
if ( is_array( $options ) ) {
$options['shop-images'] = 'plugin';
}
return $options;
}
}
ET_Builder_Theme_Compat_Betheme::init();

View File

@@ -0,0 +1,87 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Bridge theme
* @see http://bridgelanding.qodeinteractive.com/
* @since ??
*/
class ET_Builder_Theme_Compat_Bridge {
/**
* Unique instance of class
*/
public static $instance;
/**
* @var ET_Core_Data_Utils
*/
protected static $_ = null;
/**
* Constructor
*/
private function __construct(){
if ( null === self::$_ ) {
self::$_ = ET_Core_Data_Utils::instance();
}
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'wp_enqueue_scripts', array( $this, 'fix_conflicting_waypoints' ) );
}
/**
* Deregister Bridge's waypoint (outdated, v2.0.4) script so Divi Builder's waypoint script
* (v4.0.0) will be registered and equeued so builder animation work as expected since v2.0.4
* script can't run Divi's waypoint callback properly. Theme compat is only processed on builder
* page, builder preview, layout block preview, and administrator code. Bridge's waypoint seems
* to be used on Visual Composer-based page only. Since VC and builder will be used on the same
* page, this fix theoretically should be okay.
*
* Bridge theme version: 18.0.9
*
* @todo Once theme's waypoint is updated to v4.x, limit the scope of this fix to prior theme version
*
* @since ??
*/
function fix_conflicting_waypoints() {
global $wp_scripts;
$registered_waypoints = self::$_->array_get( $wp_scripts->registered, 'waypoints', '' );
$is_bridge_waypoints = strpos( $registered_waypoints->src, '/wp-content/themes/bridge/' );
// Deregister waypoints script registered by Bridge theme on builder-related page so Divi's
// waypoint script can be registered and enqueued
if ( $is_bridge_waypoints ) {
wp_deregister_script( 'waypoints' );
}
}
}
ET_Builder_Theme_Compat_Bridge::init();

View File

@@ -0,0 +1,112 @@
<?php
/**
* ET_Builder_Theme_Compat_Astra class file.
*
* @class ET_Builder_Theme_Compat_Astra
* @package Divi Builder
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Theme Compatibility for Astra theme.
*
* @see https://wordpress.org/themes/astra/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Astra {
/**
* Unique instance of class.
*
* @since ??
*
* @var ET_Builder_Theme_Compat_Astra
*/
public static $instance;
/**
* Constructor.
*
* @since ??
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class.
*
* @since ??
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress.
*
* @since ??
*/
public function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found.
if ( ! $version ) {
return;
}
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
// Method `astra_attr()` generates HTML attributes and already runs escaping process
// on each of the attribute values.
// @see {Astra_Attr::astra_attr()}.
$page_container_attrs = astra_attr(
'site',
array(
'id' => 'page',
'class' => 'hfeed site',
)
);
?>
<div <?php echo et_core_esc_previously( $page_container_attrs ); ?>>
<div id="content" class="site-content">
<div class="ast-container">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div>
</div><!-- #content -->
</div><!-- #page -->
<?php
}
}
ET_Builder_Theme_Compat_Astra::init();

View File

@@ -0,0 +1,100 @@
<?php
/**
* ET_Builder_Theme_Compat_Iconic_One class file.
*
* @class ET_Builder_Theme_Compat_Iconic_One
* @package Divi Builder
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Theme Compatibility for Iconic One theme.
*
* @see https://wordpress.org/themes/iconic-one/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Iconic_One {
/**
* Unique instance of class.
*
* @since ??
*
* @var ET_Builder_Theme_Compat_Iconic_One
*/
public static $instance;
/**
* Constructor.
*
* @since ??
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class.
*
* @since ??
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress.
*
* @since ??
*/
public function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found.
if ( ! $version ) {
return;
}
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
?>
<div id="page" class="site">
<div id="main" class="wrapper">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div><!-- #main -->
</div><!-- #page -->
<?php
}
}
ET_Builder_Theme_Compat_Iconic_One::init();

View File

@@ -0,0 +1,102 @@
<?php
/**
* ET_Builder_Theme_Compat_Portfolio_Press class file.
*
* @class ET_Builder_Theme_Compat_Portfolio_Press
* @package Divi Builder
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Theme Compatibility for Portfolio Press theme.
*
* @see https://wordpress.org/themes/portfolio-press/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Portfolio_Press {
/**
* Unique instance of class.
*
* @since ??
*
* @var ET_Builder_Theme_Compat_Portfolio_Press
*/
public static $instance;
/**
* Constructor.
*
* @since ??
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class.
*
* @since ??
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress.
*
* @since ??
*/
public function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found.
if ( ! $version ) {
return;
}
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
?>
<div id="page">
<div id="main">
<div class="col-width">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div>
</div><!-- #main -->
</div><!-- #page -->
<?php
}
}
ET_Builder_Theme_Compat_Portfolio_Press::init();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,183 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Enfold theme
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_Enfold {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* Note: once this issue is fixed in future version, run version_compare() to limit the scope of the hooked fix
* Latest theme version: 3.8
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Up to: latest theme version
// Fixing styling quirks on visual builder
if ( function_exists( 'et_fb_is_enabled' ) && et_fb_is_enabled() ) {
add_action( 'wp_enqueue_scripts', array( $this, 'add_fb_styling_fix' ), 12 );
}
add_filter( 'avf_enqueue_wp_mediaelement', array( $this, 'force_load_mediaelement_on_visual_builder' ), 10, 2 );
add_action( 'et_pb_shop_before_print_shop', array( $this, 'reset_shop_onsale_position') );
add_action( 'et_pb_shop_after_print_shop', array( $this, 'return_shop_onsale_position') );
add_action( 'et_pb_shop_before_print_shop', array( $this, 'register_shop_thumbnail' ) );
add_action( 'et_builder_wc_product_before_render_layout_registration', array( $this, 'remove_builder_wc_product_elements' ) );
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Add inline styling for fixing visual builder's design quirks on enfold theme
* @return void
*/
function add_fb_styling_fix() {
// Avoid module settings modal to be overlapped by header, footer, and sidebar. The z-index has to be higher than #scroll-top-link.avia_pop_class (1030)
$style = '.et-fb #main .container > main { z-index: 1040; }';
wp_add_inline_style( 'avia-dynamic', $style );
}
function reset_shop_onsale_position() {
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
}
function return_shop_onsale_position() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10);
}
/**
* Remove Enfold's product thumbnail on shop module and add Divi's product thumbnail
* @since 1.3.10
* @return void
*/
function register_shop_thumbnail() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'avia_woocommerce_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
}
/**
* Force load mediaelement on visual builder. Enfold has theme option at `Dashboard > Enfold >
* Performance > Disable Features > Self hosted videos and audio features (WP-Mediaelement
* scripts` which disable mediaelement in certain occassion for performance and it causes visual
* builder scripts not being loaded because `wp-mediaelement` is one of its dependency
*
* Enfold Theme version: 4.5.6
*
* @todo Once this issue no longer exist, limit the scope of this fix using version_compare
*
* @since ??
*
* @param bool $condition
* @param array $options
*
* @return bool modified $condition
*/
function force_load_mediaelement_on_visual_builder( $condition, $options ) {
if ( et_core_is_fb_enabled() ) {
return true;
}
return $condition;
}
/**
* Remove unwanted WC products element added by theme; builder's WooCommerce module
* will render these element (if added to the layout)
*
* @since ??
*
* @return void
*/
function remove_builder_wc_product_elements() {
// Remove product data tabs which causes builder layout to be rendered twice
remove_action(
'woocommerce_after_single_product_summary',
'woocommerce_output_product_data_tabs',
1
);
// Remove the related products and upsells
remove_action(
'woocommerce_after_single_product_summary',
'avia_woocommerce_display_output_upsells',
30
);
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
$scroll_offset = '';
if ( function_exists( 'avia_header_setting' ) ) {
$scroll_offset = avia_header_setting( 'header_scroll_offset' );
}
?>
<!-- Additional wrapper to fix sidebar issue because they locate id 'top' on body. -->
<div id="top">
<div id="wrap_all">
<div id="main" class="all_colors" data-scroll-offset="<?php echo esc_attr( $scroll_offset ); ?>"">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div><!-- #main -->
</div><!-- #wrap_all -->
</div><!-- #top -->
<?php
}
}
ET_Builder_Theme_Compat_Enfold::init();

View File

@@ -0,0 +1,101 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for evolve theme
* @since 1.0
*/
class ET_Builder_Theme_Compat_evolve {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Fixing v3.4.4 and below issue
// @todo once this issue is fixed in future version, run version_compare() to limit the scope of this fix
add_action( 'wp_enqueue_scripts', array( $this, 'add_styling_fix' ), 12 );
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Add inline styling for fixing design quirks on evolve theme
* @return void
*/
function add_styling_fix() {
$style = '.et-boc .widget-content{ margin: 0 0px 35px 0px; padding: 10px 0 21px 0; } \n';
$style .= '.et-boc input[type="submit"], .et-boc button, .et-boc .button, .et-boc input#submit { color: inherit !important; }';
wp_add_inline_style( 'et-builder-modules-style', $style );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
// Remove things related to default header.
remove_action( 'evolve_header_area', 'evolve_sticky_header_open', 20 );
remove_action( 'evolve_header_area', 'evolve_header_block_above', 30 );
remove_action( 'evolve_header_area', 'evolve_header_type', 40 );
remove_action( 'evolve_header_area', 'evolve_sticky_header_close', 50 );
remove_action( 'evolve_header_area', 'evolve_header_block_below', 60 );
do_action( 'evolve_header_area' );
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
// Remove things related to default footer.
remove_action( 'evolve_footer_area', 'evolve_footer_container_open', 20 );
remove_action( 'evolve_footer_area', 'evolve_footer_widgets', 30 );
remove_action( 'evolve_footer_area', 'evolve_custom_footer', 40 );
remove_action( 'evolve_footer_area', 'evolve_footer_container_close', 50 );
remove_action( 'evolve_footer_area', 'evolve_back_to_top', 60 );
do_action( 'evolve_footer_area' );
}
}
ET_Builder_Theme_Compat_evolve::init();

View File

@@ -0,0 +1,134 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Flatsome theme
* @see http://flatsome.uxthemes.com/
* @since 1.0
*/
class ET_Builder_Theme_Compat_Flatsome {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10 );
add_action( 'et_pb_shop_before_print_shop', array( $this, 'register_shop_thumbnail' ) );
add_action( 'et_builder_wc_product_before_render_layout_registration', array( $this, 'remove_builder_wc_product_elements' ) );
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Description
* @since 1.0
* @return void
*/
function admin_enqueue_scripts() {
if ( ! function_exists( 'get_current_screen' ) ) {
return;
}
$current_screen = get_current_screen();
// Only load in post-editing screen
if ( isset( $current_screen->base ) && 'post' === $current_screen->base ) {
wp_enqueue_script( 'et_pb_theme_flatsome_editor', ET_BUILDER_PLUGIN_URI . '/theme-compat/js/flatsome-editor.js', array( 'et_pb_admin_js', 'jquery' ), ET_BUILDER_VERSION, true );
}
}
/**
* Remove Flatsome's product thumbnail on shop module and add Divi's product thumbnail
* @since 1.3.10
* @return void
*/
function register_shop_thumbnail() {
remove_action( 'flatsome_woocommerce_shop_loop_images', 'woocommerce_template_loop_product_thumbnail', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
}
/**
* Remove unwanted WC products element added by theme; builder's WooCommerce module
* will render these element (if added to the layout)
*
* @since ??
*
* @return void
*/
function remove_builder_wc_product_elements() {
// Remove custom breadcrumb added by Flatsome
remove_action( 'flatsome_breadcrumb' , 'woocommerce_breadcrumb', 20 );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
$main_classes = '';
// Ensure `flatsome_main_classes` exists to avoid fatal error if it's removed.
if ( function_exists( 'flatsome_main_classes' ) ) {
ob_start();
flatsome_main_classes();
$main_classes = ob_get_clean();
}
?>
<div id="wrapper">
<main id="main" class="<?php echo esc_attr( $main_classes ); ?>">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</main><!-- #main -->
</div><!-- #wrapper -->
<?php
}
}
ET_Builder_Theme_Compat_Flatsome::init();

View File

@@ -0,0 +1,230 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Foxy theme
* @see https://www.elegantthemes.com/gallery/foxy/
* @since 2.2.7
*/
class ET_Builder_Theme_Compat_Foxy {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Fixing quirks on shop module loop
add_action( 'et_pb_shop_before_print_shop', array( $this, 'deregister_woocommerce_adjustments' ) );
add_action( 'et_pb_shop_after_print_shop', array( $this, 'reregister_woocommerce_adjustments' ) );
// Fixing styling quirks
add_action( 'wp_enqueue_scripts', array( $this, 'add_styling_fix' ), 12 );
// Modify shop module's advanced options
add_filter( 'et_pb_shop_advanced_options', array( $this, 'modify_shop_advanced_options' ), 10, 3 );
}
/**
* Deregister changes made by Foxy theme on WooCommerce commerce component inside shop module
* @since 2.2.7
* @return void
*/
function deregister_woocommerce_adjustments() {
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
// Foxy overwrites woocommerce_template_loop_price() which causes shop module appearance to
// be unexpected. Remove initial hook and replace it with compatibility hook which replicate
// the original woocommerce_template_loop_price() content
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
add_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'default_woocommerce_template_loop_price' ), 10 );
}
/**
* Re-register changes made by Foxy theme on WooCommerce commerce component after shop module is
* done so it doesn't affect WooCommerce component outside shop module
* @since 2.2.7
* @return void
*/
function reregister_woocommerce_adjustments() {
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
// Deregister compatibility hook and re-register original hook to avoid WooCommerce output
// outside shop module
add_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', array( $this, 'default_woocommerce_template_loop_price' ), 10 );
}
/**
* Provide default WooCommerce woocommerce_template_loop_price() which is overwritten by Foxy theme
* @since 2.2.7
* @return void
*/
function default_woocommerce_template_loop_price() {
if ( function_exists( 'wc_get_template') ) {
wc_get_template( 'loop/price.php' );
}
}
/**
* Modify shop module's advanced options configuration
* @param array $options default toggle module option
* @param string $slug module slug
* @param string $main_css_element main css selector
* @return array modified option
*/
function modify_shop_advanced_options( $options, $slug, $main_css_element ) {
// Add important tag to shop module's title CSS
$options['fonts']['title']['css']['important'] = array( 'size' );
return $options;
}
/**
* Add inline styling for fixing design quirks on Foxy theme
* @since 2.2.7
* @return void
*/
function add_styling_fix() {
global $post;
$is_fb = et_fb_enabled();
// Added styling adjustment for shop module
$has_shop_module = isset( $post->post_content ) && has_shortcode( $post->post_content, 'et_pb_shop' );
if ( $has_shop_module || $is_fb ) {
$shop_compat_style = '
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce ul.products li.product {
margin: 0 3.05% 2.992em 0 !important;
width: 22.05% !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce.columns-1 ul.products li.product {
width: 100% !important;
margin-right: 0;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce.columns-2 ul.products li.product {
width: 48% !important;
margin: 0 2% 2.992em 0 !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce.columns-3 ul.products li.product {
width: 30.75% !important;
margin-right: 2.5% !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce.columns-4 ul.products li.product {
margin-right: 2.9% !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce.columns-5 ul.products li.product {
width: 16.95% !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .woocommerce-page.columns-6 ul.products li.product,
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .woocommerce.columns-6 ul.products li.product {
width: 13.5% !important;
margin: 0 3.8% 2.992em 0 !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .onsale {
right: auto !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce ul.products li.product h3 {
font-size: 1em !important;
padding: .3em 0 !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_shop .woocommerce ul.products li.product .star-rating {
margin: 4px 0 0.7em 0 !important;
}
';
wp_add_inline_style( 'et-builder-modules-style', $shop_compat_style );
}
// Added styling adjustment for comments module
$has_comments_module = isset( $post->post_content ) && has_shortcode( $post->post_content, 'et_pb_comments' );
if ( $has_comments_module || $is_fb ) {
$comments_compat_style = '
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .comment-body {
padding: 40px 40px 90px;
min-height: 110px;
margin-bottom: 80px;
background: white;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .comment-reply-link.et_pb_button {
bottom: -60px;
top: auto;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .testimonial-author {
padding-left: 40px;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .testimonial-author .et-avatar:before {
box-shadow: none !important;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .testimonial-author .et-avatar {
padding: 5px;
border-radius: 50%;
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.3);
margin-right: 25px;
background: white;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .testimonial-author .avatar {
border-radius: 50%;
display: block;
}
' . ET_BUILDER_CSS_LAYOUT_PREFIX . ' .et_pb_comments_module .testimonial-author strong {
padding: 18px 0 0;
}
@media (max-width: 767px) {
' . ET_BUILDER_CSS_PREFIX . ' #comment-wrap li.comment article {
padding-right: 40px;
}
}
';
wp_add_inline_style( 'et-builder-modules-style', $comments_compat_style );
}
}
}
ET_Builder_Theme_Compat_Foxy::init();

View File

@@ -0,0 +1,74 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Impreza theme
* @see http://impreza.us-themes.com/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Impreza {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'wp_enqueue_scripts', array( $this, 'layout_block_preview_dequeue_scripts' ) );
}
/**
* Dequeue external and on-page scripts that causes layout block preview rendering breaks
* because expected object that is rendered on page doesn't exist on layout block preview
*
* Impreza Theme Version: 6.0.4
*
* @todo Once this issue no longer exist, limit the scope of this fix using version_compare
*
* @since ??
*/
function layout_block_preview_dequeue_scripts() {
if ( ! ET_GB_Block_Layout::is_layout_block_preview() ) {
return;
}
// This action hook removal can be done on init_hooks() (doesn't have to be done here)
// but it is better for it to be grouped with the script removal
remove_action( 'wp_footer', 'us_pass_header_settings_to_js', - 2 );
wp_dequeue_script( 'us-core' );
}
}
ET_Builder_Theme_Compat_Impreza::init();

View File

@@ -0,0 +1 @@
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){var r;r=jQuery,jQuery(".et_pb_module li.last").each((function(){var e=r(this);setTimeout((function(){e.addClass("last")}),1e3)}))}]);

View File

@@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t){var n;(n=jQuery)(document).ready((function(){n("#et_pb_toggle_builder, #et_pb_main_container").on("click",(function(e){!function(){if(n("#enable-uxbuilder").length&&n("#enable-uxbuilder").hasClass("nav-tab-active")){var e,t=new Date;t.setTime(t.getTime()+31536e6),e="; expires="+t.toUTCString(),document.cookie="uxbuilder=disabled"+e+"; path=/",n("#uxbuilder-enable-disable a").removeClass("nav-tab-active"),n("html").attr("data-uxbuilder","disabled"),n("#disable-uxbuilder").addClass("nav-tab-active"),n(window).trigger("resize")}}()}))}))}]);

View File

@@ -0,0 +1 @@
!function(e){var t={};function i(r){if(t[r])return t[r].exports;var n=t[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=t,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=2)}({2:function(e,t){!function(e){ET_PageBuilder.Theme_Compat_Make=window.wp.Backbone.View.extend({initialize:function(){this.listenTo(Backbone.Events,"et-activate-builder",this.activateDiviBuilder),this.listenTo(Backbone.Events,"et-deactivate-builder",this.deactivateDiviBuilder)},activateDiviBuilder:function(){this.toggleMakeBuilder("off")},deactivateDiviBuilder:function(){this.toggleMakeBuilder("on")},toggleMakeBuilder:function(t){var i=e("#ttfmake-builder"),r=e("#page_template"),n=r.find('option[value="template-builder.php"]');"on"===t?(i.show(),n.attr({selected:"selected"}).removeAttr("disabled")):(i.hide(),n.attr({disabled:"disabled"}).removeAttr("selected")),r.trigger("change")}});var t=new ET_PageBuilder.Theme_Compat_Make;e("#et_pb_toggle_builder.et_pb_builder_is_used").length&&t.activateDiviBuilder()}(jQuery)}});

View File

@@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}({3:function(e,t){var n;n=jQuery,window.et_pb_salient_fix_loading_attempts_count=0,n(document).ready((function(){!function e(){window.et_pb_salient_fix_loading_attempts_count++,n("#ajax-loading-screen").length&&"0"!==n("#ajax-loading-screen").css("opacity")?window.et_pb_salient_fix_loading_attempts_count<=15&&setTimeout((function(){e()}),1e3):n(document).trigger("resize")}()}))}});

View File

@@ -0,0 +1 @@
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=4)}({4:function(e,t){jQuery(document).on("et_fb_shop_componentDidMount et_fb_shop_componentDidUpdate",(function(e,t){setTimeout((function(){var e=t.$el.find(".wf-container"),n=e.width(),r="0"===t.columnsNumber?2:parseInt(t.columnsNumber),o=parseInt(n/r);e.find(".product").removeAttr("style").css({width:o,display:"inline-block"}),e.masonry({itemSelector:".product",fitWidth:!0}),e.IsoLayzrInitialisation()}),0)}))}});

View File

@@ -0,0 +1,55 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Jupiter theme
* @see https://jupiter.artbees.net/
* @since ??
*/
class ET_Builder_Theme_Compat_Jupiter {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
*
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Remove prev/next nav on layout block preview page
if ( ET_GB_Block_Layout::is_layout_block_preview() ) {
remove_action('wp_footer', 'mk_get_single_post_prev_next');
}
}
}
ET_Builder_Theme_Compat_Jupiter::init();

View File

@@ -0,0 +1,65 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for JupiterX theme
* @since ??
*/
class ET_Builder_Theme_Compat_JupiterX {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// The callback is hooked into `template_redirect` because that's where JupiterX registers
// its callback. See: `jupiterx_add_smart_action( 'template_redirect', 'jupiterx_load_global_fragments', 1 );`
add_action( 'template_redirect', array( $this, 'remove_builder_wc_product_elements' ) );
}
/**
* Remove unwanted WC products element added by theme; builder's WooCommerce module
* will render these element (if added to the layout)
*
* @since ??
*
* @return void
*/
function remove_builder_wc_product_elements() {
remove_action( 'woocommerce_single_product_summary', 'jupiterx_product_page_badges', 4 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 12 );
}
}
ET_Builder_Theme_Compat_JupiterX::init();

View File

@@ -0,0 +1,133 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Make theme
* @see https://wordpress.org/themes/make/
* @since 1.0
*/
class ET_Builder_Theme_Compat_Make {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Fixing Make v1.6.4 below compatibility issue
// @todo once this issue is fixed in future version, run version_compare() to limit the scope of this fix
add_filter( 'make_will_be_builder_page', array( $this, 'adjust_builder_page_status' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 10 );
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'add_styling_fix' ), 11 );
}
/**
* Make will not save Divi Builder layout if template-builder.php is selected. Fortunately,
* Make has a filter to determine wheather a page should use template-builder.php or not during post saving
* If Divi Builder is known to be used while the page template is set to template-builder.php,
* cancel template-builder.php usage. This doesn't distract user and work smoothly on the backend
* @since 1.0
* @return bool
*/
function adjust_builder_page_status( $use_builder ) {
if ( isset( $_POST['et_pb_use_builder'] ) && 'on' === $_POST['et_pb_use_builder'] ) {
return 0;
}
return $use_builder;
}
/**
* Description
* @since 1.0
* @return void
*/
function admin_enqueue_scripts() {
if ( ! function_exists( 'get_current_screen' ) ) {
return;
}
$current_screen = get_current_screen();
// Only load in post-editing screen
if ( isset( $current_screen->base ) && 'post' === $current_screen->base ) {
wp_enqueue_script( 'et_pb_theme_compat_make_editor', ET_BUILDER_PLUGIN_URI . '/theme-compat/js/make-editor.js', array( 'et_pb_admin_js', 'jquery' ), ET_BUILDER_VERSION, true );
}
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
?>
<div id="site-wrapper" class="site-wrapper">
<div id="site-content" class="site-content">
<div class="container">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div><!-- .container -->
</div><!-- #site-content -->
</div><!-- #site-wrapper -->
<?php
}
/**
* Add inline styling for fixing design quirks on Make theme.
*
* @since ??
*/
public function add_styling_fix() {
$style = '#et-boc #site-content { float: none; }';
wp_add_inline_style( 'et-builder-modules-style', $style );
}
}
ET_Builder_Theme_Compat_Make::init();

View File

@@ -0,0 +1,95 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Raindrops theme
* @since 1.0
*/
class ET_Builder_Theme_Compat_Raindrops {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* Note: once this issue is fixed in future version, run version_compare() to limit the scope of the hooked fix
* Latest theme version: 1.326
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Up to: latest theme version
// Removing prepended featured image on title on blog module
if ( et_pb_is_pagebuilder_used( get_the_ID() ) ) {
remove_filter( 'the_title', 'raindrops_fallback_title', 10 );
}
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
$page_container_id = '';
$page_container_class = '';
if ( function_exists( 'raindrops_warehouse' ) ) {
$page_container_id = raindrops_warehouse( 'raindrops_page_width' );
$page_container_class = 'yui-' . raindrops_warehouse( 'raindrops_col_width' );
}
?>
<div id="<?php echo esc_attr( $page_container_id ); ?>" class="<?php echo esc_attr( $page_container_class ); ?> hfeed">
<div id="bd" class="clearfix">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div><!-- #bd -->
</div><!-- #doc -->
<?php
}
}
ET_Builder_Theme_Compat_Raindrops::init();

View File

@@ -0,0 +1,61 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Salient theme
* @since 1.0
*/
class ET_Builder_Theme_Compat_Salient {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Enqueue custom script to fix the audio module init ( on actual fronend only )
if ( ! et_fb_is_enabled() ) {
wp_enqueue_script( 'et_pb_theme_salient', ET_BUILDER_PLUGIN_URI . '/theme-compat/js/salient-frontend.js', array( 'jquery' ), ET_BUILDER_VERSION, true );
}
add_action( 'et_pb_shop_before_print_shop', array( $this, 'et_pb_fix_shop_module' ) );
}
function et_pb_fix_shop_module() {
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
remove_action( 'woocommerce_before_shop_loop_item_title', 'product_thumbnail_with_cart', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'product_thumbnail_with_cart_alt', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'product_thumbnail_material', 10 );
}
}
ET_Builder_Theme_Compat_Salient::init();

View File

@@ -0,0 +1,84 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for SmartMag theme
* @see http://theme-sphere.com
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_SmartMag {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'et_pb_shop_before_print_shop', array( $this, 'register_shop_thumbnail' ) );
add_action( 'wp_enqueue_scripts', array($this, 'dequeue_scripts') );
}
/**
* Remove SmartMag's product thumbnail on shop module and add Divi's product thumbnail
* @since 1.3.10
* @return void
*/
function register_shop_thumbnail() {
global $wp_filter;
$item_title_hook = isset( $wp_filter['woocommerce_before_shop_loop_item_title'] ) ? $wp_filter['woocommerce_before_shop_loop_item_title'] : false;
if ( class_exists( 'Bunyad' ) && null !== Bunyad::get('smart_mag') && isset( Bunyad::get('smart_mag')->woocommerce ) ) {
remove_action( 'woocommerce_before_shop_loop_item_title', array( Bunyad::get('smart_mag')->woocommerce, 'cart_icon' ), 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
}
}
/**
* Dequeue SmartMag's script which causes conflict in particular situation
*
* @since ??
*
* @return void
*/
function dequeue_scripts() {
// Fixed disappearing block preview layout because SmartMatg's frontend code expects
// `.navigation-wrap` to be exist and retrieving its offset value without further check
// which breaks js and keep preview rendering blank on layout block
if ( ET_GB_Block_Layout::is_layout_block_preview() ) {
wp_dequeue_script( 'bunyad-theme' );
}
}
}
ET_Builder_Theme_Compat_SmartMag::init();

View File

@@ -0,0 +1,108 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for The7 theme
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_The7 {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* Note: once this issue is fixed in future version, run version_compare() to limit the scope of the hooked fix
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Up to: latest theme version
add_filter( 'et_fb_bundle_dependencies', array( $this, 'add_fb_bundle_dependencies' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_fb_compat_script' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'fix_woocommerce_styling' ), 20 );
add_action( 'et_pb_get_shop_html_before', array( $this, 'fix_shortcode_object' ) );
}
/**
* Fix WooCommerce styling
*/
function fix_woocommerce_styling() {
$style = '
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .featured { display: block !important; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .product { padding: 10px; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .product .woo-buttons-on-img img { display: block; width: 100%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-1 .wf-cell { width: 100%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-2 .wf-cell { width: 49%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-3 .wf-cell { width: 33.33%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-4 .wf-cell { width: 25%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-5 .wf-cell { width: 20%; }
' . ET_BUILDER_CSS_PREFIX . ' .et_pb_shop .woocommerce.columns-6 .wf-cell { width: 16.4%; }
';
wp_add_inline_style( 'dt-main', $style );
}
/**
* Register theme compat script as bundle.js' dependency so it is being loaded before bundle.js
*/
function add_fb_bundle_dependencies( $deps ) {
$deps[] = 'et_fb_theme_the7';
return $deps;
}
/**
* Enqueueing scripts for FB
*/
function enqueue_fb_compat_script() {
if ( et_fb_is_enabled() ) {
wp_enqueue_script( 'et_fb_theme_the7', ET_BUILDER_PLUGIN_URI . '/theme-compat/js/the7-fb.js', array( 'jquery' ), ET_BUILDER_VERSION, true );
}
}
/*
* Modify the7's option to make it outputs correct shop HTML data
*/
function fix_shortcode_object() {
if ( function_exists( 'presscore_get_config' ) && function_exists( 'of_get_option' ) ) {
$config = presscore_get_config();
$config->set( 'post.preview.description.style', of_get_option( 'woocommerce_display_product_info', 'under_image' ) );
$config->set( 'show_titles', of_get_option( 'woocommerce_show_product_titles', true ) );
$config->set( 'product.preview.show_price', of_get_option( 'woocommerce_show_product_price', true ), true );
$config->set( 'product.preview.show_rating', of_get_option( 'woocommerce_show_product_rating', true ), true );
$config->set( 'product.preview.icons.show_cart', of_get_option( 'woocommerce_show_cart_icon', true ), true );
$config->set( 'product.preview.add_to_cart.position', of_get_option( 'woocommerce_add_to_cart_position', 'on_image' ) );
}
}
}
ET_Builder_Theme_Compat_The7::init();

View File

@@ -0,0 +1,65 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Twenty Nineteen theme
* @see https://wordpress.org/themes/twentynineteen/
* @since ??
*/
class ET_Builder_Theme_Compat_Twentynineteen {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'wp_enqueue_scripts', array( $this, 'dequeue_scripts' ) );
}
/**
* Dequeue touch keyboard navigation js in visual builder since it is not used on visual builder
* (cannot builder layout via keyboard only afterall) and it triggers error due to document
* referencing which cannot be overwritten
*
* @since ??
* @return void
*/
function dequeue_scripts() {
if ( has_nav_menu( 'menu-1' ) && et_core_is_fb_enabled() ) {
wp_dequeue_script( 'twentynineteen-touch-navigation' );
}
}
}
ET_Builder_Theme_Compat_Twentynineteen::init();

View File

@@ -0,0 +1,104 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Twenty Seventeen theme
* @see https://wordpress.org/themes/twentyseventeen/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Twentyseventeen {
/**
* Unique instance of class.
*
* @var self
*/
public static $instance;
/**
* Constructor.
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class.
*
* @since ??
*
* @return self
*/
public static function init() {
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress.
*
* @since ??
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'wp_enqueue_scripts', array( $this, 'dequeue_scripts' ) );
add_filter( 'body_class', array( $this, 'remove_body_class_in_theme_builder' ) );
}
/**
* Dequeue conflicting scripts
*
* @since ??
*
* @return void
*/
function dequeue_scripts() {
// Dequeue twentyseventeen-global script on layout block preview screen. It expects
// #secondary to be exist while on layout block preview, header and footer content is
// cleaned up for previewing purpose. The absence of #seconday triggers broken object element
// which breaks layout block previewing on block editor. Thus, this script dequeueing
if ( ET_GB_Block_Layout::is_layout_block_preview() ) {
wp_dequeue_script( 'twentyseventeen-global' );
}
}
/**
* Remove classes that trigger special JS functionality which does not apply
* while using the Theme Builder.
*
* @param string[] $classes
*
* @return string[]
*
* @since ??
*/
function remove_body_class_in_theme_builder( $classes ) {
if ( ! et_builder_tb_enabled() ) {
return $classes;
}
$blocklist = array( 'has-sidebar' );
$filtered = array();
foreach ( $classes as $class ) {
if ( ! in_array( $class, $blocklist, true ) ) {
$filtered[] = $class;
}
}
return $filtered;
}
}
ET_Builder_Theme_Compat_Twentyseventeen::init();

View File

@@ -0,0 +1,142 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Twenty Sixteen theme
* @see https://wordpress.org/themes/twentysixteen/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Twentysixteen {
/**
* Unique instance of class
*
* @since ??
*/
public static $instance;
/**
* Constructor
*
* @since ??
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*
* @since ??
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
*
* @since ??
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action(
'wp_enqueue_scripts',
array( $this, 'enqueue_non_singular_builder_inline_style' ),
20
);
// Fix missing theme page container when TB is enabled.
add_action( 'et_theme_builder_template_after_header', array( $this, 'theme_builder_after_header' ) );
add_action( 'et_theme_builder_template_before_footer', array( $this, 'theme_builder_before_footer' ) );
}
/**
* Enqueue inline style needed to fix style glitch due to main query's loop being wrapped
* when one of the post use builder
*
* @since ??
*/
function enqueue_non_singular_builder_inline_style() {
global $wp_query;
if ( ! et_dbp_should_wrap_content_has_builder( $wp_query ) ) {
return;
}
$inline_styles = <<<EOT
.et_builder_outer_content > article {
margin-bottom: 3.5em;
position: relative;
}
@media screen and (min-width: 44.375em) {
.et_builder_outer_content > article {
margin-bottom: 5.25em;
}
}
@media screen and (min-width: 61.5625em) {
.et_builder_outer_content > article {
margin-bottom: 7.0em;
}
}
.et_builder_outer_content > article:before,
.et_builder_outer_content > article:after {
content: "";
display: table;
}
.et_builder_outer_content > article:after {
clear: both;
}
EOT;
wp_add_inline_style( 'et-builder-modules-style', $inline_styles );
}
/**
* Display theme opening container.
*
* Provide the opening container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_after_header() {
?>
<div id="page" class="site">
<div class="site-inner">
<div id="content" class="site-content">
<?php
}
/**
* Display theme closing container.
*
* Provide the closing container tag only to ensure TB layout works smoothly.
*
* @since ??
*/
public function theme_builder_before_footer() {
?>
</div><!-- #content -->
</div><!-- .site-inner -->
</div><!-- #page -->
<?php
}
}
ET_Builder_Theme_Compat_Twentysixteen::init();

View File

@@ -0,0 +1,91 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Twenty Twenty theme
* @see https://wordpress.org/themes/twentytwenty/
*
* @since ??
*/
class ET_Builder_Theme_Compat_Twentytwenty {
/**
* Unique instance of class
*
* @since ??
*/
public static $instance;
/**
* Constructor
*
* @since ??
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*
* @since ??
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
*
* @since ??
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action(
'wp_enqueue_scripts',
array( $this, 'enqueue_non_singular_builder_inline_style' ),
20
);
}
/**
* Enqueue inline style needed to fix style glitch due to main query's loop being wrapped
* when one of the post use builder
*
* @since ??
*/
function enqueue_non_singular_builder_inline_style() {
global $wp_query;
if ( ! et_dbp_should_wrap_content_has_builder( $wp_query ) ) {
return;
}
$inline_styles = <<<EOT
body:not(.singular) .et_builder_outer_content > article:first-of-type {
padding: 4rem 0 0;
}
@media ( min-width: 700px ) {
body:not(.singular) .et_builder_outer_content > article:first-of-type {
padding: 8rem 0 0;
}
}
EOT;
wp_add_inline_style( 'et-builder-modules-style', $inline_styles );
}
}
ET_Builder_Theme_Compat_Twentytwenty::init();

View File

@@ -0,0 +1,57 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Virtue theme
* @see https://wordpress.org/themes/virtue/
* @since 1.0
*/
class ET_Builder_Theme_Compat_Virtue {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Fixing Virtue v2.5.6 below compatibility issue
// @todo once this issue is fixed in future version, run version_compare() to limit the scope of this fix
// Remove Virtue's template wrapper on preview screen
if ( is_et_pb_preview() ) {
remove_filter( 'template_include', array( 'Kadence_Wrapping', 'wrap' ), 101 );
}
}
}
ET_Builder_Theme_Compat_Virtue::init();

View File

@@ -0,0 +1,76 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Weblizar theme
* @since 1.0
*/
class ET_Builder_Theme_Compat_Weblizar {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* Note: once this issue is fixed in future version, run version_compare() to limit the scope of the hooked fix
* Latest theme version: 3.2
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Up to: latest theme version
// Modify widget search selector
add_filter( 'et_pb_widget_search_selector', array( $this, 'widget_search_selector' ) );
// Fixing styling quirks
add_action( 'wp_enqueue_scripts', array( $this, 'add_styling_fix' ), 12 );
}
/**
* Instead of using default .widget.widget_search structure for its widget search, weblizar uses custom widget
* wrapper structure. Hence, this method adjust the widget search selector so divi builder's conditional class
* and other UX enhancement for widget search in sidebar module can be implemented
* @return string
*/
function widget_search_selector( $selector ) {
return '.sidebar-block .sidebar-content.blog-search';
}
/**
* Add inline styling for fixing design quirks on weblizar theme
* @return void
*/
function add_styling_fix() {
$style = ET_BUILDER_CSS_PREFIX . ' .et_pb_widget_area .sidebar-block { margin-top: 0; margin-bottom: 30px; color: inherit; }';
wp_add_inline_style( 'et-builder-modules-style', $style );
}
}
ET_Builder_Theme_Compat_Weblizar::init();

View File

@@ -0,0 +1,75 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for X theme
* @see http://theme.co/x/
* @since 1.3.10
*/
class ET_Builder_Theme_Compat_X {
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct(){
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init(){
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
add_action( 'et_pb_shop_before_print_shop', array( $this, 'register_shop_thumbnail' ) );
add_action( 'et_builder_wc_product_before_render_layout', array( $this, 'remove_builder_wc_product_elements' ) );
}
/**
* Remove X's product thumbnail on shop module and add Divi's product thumbnail
* @since 1.3.10
* @return void
*/
function register_shop_thumbnail() {
remove_action( 'woocommerce_before_shop_loop_item_title', 'x_woocommerce_shop_product_thumbnails', 10 );
add_action( 'woocommerce_before_shop_loop_item_title', 'et_divi_builder_template_loop_product_thumbnail', 10);
}
/**
* Remove unwanted WC products element added by theme; builder's WooCommerce module
* will render these element (if added to the layout)
*
* @since ??
*
* @return void
*/
function remove_builder_wc_product_elements() {
// Remove related products element outside builder
remove_action( 'woocommerce_after_single_product_summary', 'x_woocommerce_output_related_products', 20 );
}
}
ET_Builder_Theme_Compat_X::init();

View File

@@ -0,0 +1,66 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/**
* Theme Compatibility for Zerif Lite theme
* @since 1.0
*/
class ET_Builder_Theme_Compat_Zerif_Lite{
/**
* Unique instance of class
*/
public static $instance;
/**
* Constructor
*/
private function __construct() {
$this->init_hooks();
}
/**
* Gets the instance of the class
*/
public static function init() {
if ( null === self::$instance ){
self::$instance = new self();
}
return self::$instance;
}
/**
* Hook methods to WordPress
* @return void
*/
function init_hooks() {
$theme = wp_get_theme();
$version = isset( $theme['Version'] ) ? $theme['Version'] : false;
// Bail if no theme version found
if ( ! $version ) {
return;
}
// Fixing v1.8.2.3 and below issue
// @todo once this issue is fixed in future version, run version_compare() to limit the scope of this fix
add_action( 'wp_footer', array( $this, 'fix_slide_in_animation' ), 100 );
}
/**
* Remove `scrolled` event handler. Zerif Lite registers event handler for `scroll` (see /zerif-lite/js/zerif.js)
* for waypoint-esque functionality for one-pager site scenario: menu items point to particular ID so when user
* reaches section with that particular ID, menu items will turn into active state. This behaviour conflicts with
* Divi Builder's slide in animation which is powered by jQuery Waypoints. To fix this, Divi Builder deregister
* scrolled event handler considering unanimated section is more vital compared to in-page active state
* @since 1.0
* @return void
*/
function fix_slide_in_animation() {
if ( wp_script_is( 'jquery', 'done' ) && wp_script_is( 'zerif_script', 'done' ) ) {
?><script type="text/javascript">jQuery(window).off('scroll', scrolled );</script><?php
}
}
}
ET_Builder_Theme_Compat_Zerif_Lite::init();