ty($show_on_canvas) && 'true' === $show_on_canvas && 0 === strpos($template_slug, 'user-header-') ) { if ( !empty($show_on_canvas) && 'true' === $show_on_canvas && !is_null($template_slug) ) { Utilities::render_elementor_template($template_slug); } } } /** ** Footer */ public function replace_footer() { if ( $this->is_template_available('footer') ) { if ( ! in_array($this->current_theme, $this->royal_themes) ) { require __DIR__ . '/../templates/views/theme-footer.php'; } else { require __DIR__ . '/../templates/views/royal/theme-footer-royal.php'; } $templates = []; $templates[] = 'footer.php'; remove_all_actions( 'wp_footer' ); // Avoid running wp_footer hooks again. ob_start(); locate_template( $templates, true ); ob_get_clean(); } } public function add_canvas_footer() { if ( $this->is_template_available('footer') ) { $conditions = json_decode( get_option('wpr_footer_conditions', '[]'), true ); $template_slug = WPR_Conditions_Manager::header_footer_display_conditions($conditions); $template_id = Utilities::get_template_id($template_slug); if ( defined('ICL_LANGUAGE_CODE') ) { $default_language_code = apply_filters('wpml_default_language', null); IF ( ICL_LANGUAGE_CODE !== $default_language_code ) { $template_id = apply_filters('wpml_object_id', $template_id, 'wpr_templates', true, $default_language_code); } } $show_on_canvas = get_post_meta($template_id, 'wpr_footer_show_on_canvas', true); // if ( !empty($show_on_canvas) && 'true' === $show_on_canvas && 0 === strpos($template_slug, 'user-footer-') ) { if ( !empty($show_on_canvas) && 'true' === $show_on_canvas && !is_null($template_slug) ) { Utilities::render_elementor_template($template_slug); } } } public function convert_to_canvas( $template ) { $is_theme_builder_edit = \Elementor\Plugin::$instance->preview->is_preview_mode() && Utilities::is_theme_builder_template() ? true : false; $_wp_page_template = get_post_meta(get_the_ID(), '_wp_page_template', true); if ( $this->is_template_available('content') || $is_theme_builder_edit ) { if ( (is_page() || is_single()) && 'elementor_canvas' === $_wp_page_template && !$is_theme_builder_edit ) { return $template; } else { return WPR_ADDONS_PATH . 'admin/templates/wpr-canvas.php'; } } else { return $template; } } /** ** Theme Builder Content Display */ public function canvas_page_content_display() { // Get Template $template = WPR_Conditions_Manager::canvas_page_content_display_conditions(); // Display Template Utilities::render_elementor_template( $template ); } /** * Enqueue styles and scripts. */ public function enqueue_scripts() { if ( class_exists( '\Elementor\Plugin' ) ) { $elementor = \Elementor\Plugin::instance(); $elementor->frontend->enqueue_styles(); } if ( class_exists( '\ElementorPro\Plugin' ) ) { $elementor_pro = \ElementorPro\Plugin::instance(); $elementor_pro->enqueue_styles(); } // Load Header Template CSS File $heder_conditions = json_decode( get_option('wpr_header_conditions', '[]'), true ); $heder_template = WPR_Conditions_Manager::header_footer_display_conditions($heder_conditions); $header_template_id = !is_null($heder_template) ? Utilities::get_template_id($heder_template) : false; if ( false !== $header_template_id ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $header_css_file = new \Elementor\Core\Files\CSS\Post( $header_template_id ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $header_css_file = new \Elementor\Post_CSS_File( $header_template_id ); } $header_css_file->enqueue(); } // Load Footer Template CSS File $footer_conditions = json_decode( get_option('wpr_footer_conditions', '[]'), true ); $footer_template = WPR_Conditions_Manager::header_footer_display_conditions($footer_conditions); $footer_template_id = !is_null($footer_template) ? Utilities::get_template_id($footer_template) : false; if ( false !== $footer_template_id ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $footer_css_file = new \Elementor\Core\Files\CSS\Post( $footer_template_id ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $footer_css_file = new \Elementor\Post_CSS_File( $footer_template_id ); } $footer_css_file->enqueue(); } // Load Canvas Content Template CSS File $canvas_conditions = WPR_Conditions_Manager::canvas_page_content_display_conditions(); $canvas_template_id = !empty($canvas_conditions) ? Utilities::get_template_id($canvas_conditions) : false; if ( false !== $canvas_template_id ) { if ( class_exists( '\Elementor\Core\Files\CSS\Post' ) ) { $footer_css_file = new \Elementor\Core\Files\CSS\Post( $canvas_template_id ); } elseif ( class_exists( '\Elementor\Post_CSS_File' ) ) { $footer_css_file = new \Elementor\Post_CSS_File( $canvas_template_id ); } $footer_css_file->enqueue(); } } }