first
This commit is contained in:
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Avada Theme.
|
||||
*
|
||||
* @package visual-portfolio
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Visual_Portfolio_3rd_Avada
|
||||
*/
|
||||
class Visual_Portfolio_3rd_Avada {
|
||||
/**
|
||||
* Visual_Portfolio_3rd_Avada constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$avada_options = get_option( 'fusion_options' );
|
||||
|
||||
// Important - Avada folder is in uppercase, this is not a mistake.
|
||||
if ( 'Avada' !== get_template() || ! isset( $avada_options['lazy_load'] ) || 'avada' !== $avada_options['lazy_load'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable our lazyload if Avada's lazyload used.
|
||||
add_filter( 'vpf_images_lazyload', '__return_false' );
|
||||
add_filter( 'vpf_enqueue_plugin_lazysizes', '__return_false' );
|
||||
}
|
||||
}
|
||||
|
||||
new Visual_Portfolio_3rd_Avada();
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Enfold Theme.
|
||||
*
|
||||
* @package visual-portfolio
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Visual_Portfolio_3rd_Enfold
|
||||
*/
|
||||
class Visual_Portfolio_3rd_Enfold {
|
||||
/**
|
||||
* Cache for lazy loading option
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $lazy_loading_option_cache = null;
|
||||
|
||||
/**
|
||||
* Visual_Portfolio_3rd_Enfold constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
if ( is_admin() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 'enfold' !== get_template() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable Enfold lightbox by adding classname.
|
||||
add_filter( 'vpf_extend_portfolio_class', array( $this, 'disable_lightbox_class' ) );
|
||||
|
||||
// Disable our lazyload if Enfold lazyload enabled.
|
||||
add_filter( 'vpf_images_lazyload', array( $this, 'disable_lazy_load' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Enfold lightbox by adding classname.
|
||||
*
|
||||
* @param string $class - portfolio block classname.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function disable_lightbox_class( $class ) {
|
||||
$class .= ' noLightbox';
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable VPF lazy load if Enfold uses their own.
|
||||
*
|
||||
* @param boolean $return - portfolio block classname.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function disable_lazy_load( $return ) {
|
||||
$enfold_option = '';
|
||||
|
||||
if ( null !== $this->lazy_loading_option_cache ) {
|
||||
$enfold_option = $this->lazy_loading_option_cache;
|
||||
} elseif ( function_exists( 'avia_get_option' ) ) {
|
||||
$enfold_option = avia_get_option( 'lazy_loading', '' );
|
||||
}
|
||||
|
||||
if ( null === $this->lazy_loading_option_cache ) {
|
||||
$this->lazy_loading_option_cache = $enfold_option;
|
||||
}
|
||||
|
||||
if ( '' === $enfold_option ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
new Visual_Portfolio_3rd_Enfold();
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Thrive Architect Theme Builder.
|
||||
* This builder overrides page output and we can't enqueue inline dynamic styles using `wp_add_inline_style`
|
||||
*
|
||||
* @package visual-portfolio
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Visual_Portfolio_3rd_Thrive_Architect
|
||||
*/
|
||||
class Visual_Portfolio_3rd_Thrive_Architect {
|
||||
/**
|
||||
* Visual_Portfolio_3rd_Thrive_Architect constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
add_action( 'init', array( $this, 'init' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Init action.
|
||||
*/
|
||||
public function init() {
|
||||
if ( ! function_exists( 'tcb_custom_editable_content' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_filter( 'vpf_enqueue_dynamic_styles_inline_style', '__return_false' );
|
||||
}
|
||||
}
|
||||
|
||||
new Visual_Portfolio_3rd_Thrive_Architect();
|
Reference in New Issue
Block a user