ID ) ) { return true; } return false; } /** * Add global inline style * */ public function add_global_inline_style() { if ( ! Botiga_Elementor_Helpers::is_built_with_elementor() ) { return; } $inline_style = " @media(min-width: 1140px) { .e-con.e-parent>.e-con-inner { max-width: calc( var(--content-width) - 30px ); } div[data-elementor-type=\"loop-item\"] .e-con.e-parent>.e-con-inner { max-width: var(--content-width); } } body[class*=\"elementor-page\"] .content-wrapper { max-width: 100%; margin: 0; padding: 0; } div[data-elementor-type] { width: 100% !important; max-width: 100% !important; } div[data-elementor-type].post { margin: 0; } "; // Add inline style if ( ! empty( $inline_style ) ) { wp_add_inline_style( 'botiga-style', $inline_style ); } } /** * Register elementor locations * */ public function register_elementor_locations( $elementor_theme_manager ) { $elementor_theme_manager->register_location( 'header' ); $elementor_theme_manager->register_location( 'footer' ); $elementor_theme_manager->register_location( 'single' ); } /** * Extend Motion Effects with custom animations filter callback * */ public function extend_motion_effects( $additional_animations ) { $additional_animations[ 'Botiga' ] = array( 'fadeInUpShorter' => esc_html__( 'Fade In Up Shorter', 'botiga' ), 'fadeInDownShorter' => esc_html__( 'Fade In Down Shorter', 'botiga' ), 'fadeInLeftShorter' => esc_html__( 'Fade In Left Shorter', 'botiga' ), 'fadeInRightShorter' => esc_html__( 'Fade In Right Shorter', 'botiga' ), ); return $additional_animations; } } new Botiga_Elementor_Compatibility(); /** * Elementor Helper Class * */ class Botiga_Elementor_Helpers { /** * Check if a theme builder location is active * * @param string $location * @return bool */ public static function elementor_has_location( $location ) { if ( ! did_action( 'elementor_pro/init' ) ) { return false; } if( ! class_exists( 'ElementorPro\\Plugin' ) ) { return false; } $conditions_manager = \ElementorPro\Plugin::instance()->modules_manager->get_modules( 'theme-builder' )->get_conditions_manager(); $documents = $conditions_manager->get_theme_templates_ids( $location ); return ! empty( $documents ); } /** * Check if a post is built with Elementor. * * @param int $post_id * @return bool */ public static function is_built_with_elementor( $post_id = 0 ) { global $post; if ( ! $post_id && $post ) { $post_id = $post->ID; } if ( ! did_action( 'elementor/init' ) ) { return false; } if ( ! class_exists( 'Elementor\Plugin' ) ) { return false; } if ( ! empty( $post_id ) && \Elementor\Plugin::$instance->documents->get( $post_id ) && \Elementor\Plugin::$instance->documents->get( $post_id )->is_built_with_elementor() ) { return true; } else { $location_type = ''; if ( is_singular() || is_404() ) { $location_type = 'single'; } if ( is_home() || is_archive() || is_search() ) { $location_type = 'archive'; } if ( self::elementor_has_location( $location_type ) ) { return true; } } return false; } }