PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.4.9
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.4.9
3.8.0 3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 All 112 releases
← All changes | includes/Builder/Managers/LocationManager.php +26 -13 3.1.0 → 3.4.9 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Templately\Builder\Managers;
4 4
5 5 use EbStyleHandler;
6 +use EssentialBlocks\Modules\StyleHandler;
6 7 use Templately\Builder\PageTemplates;
7 8 use Templately\Builder\Source;
8 9 use Templately\Builder\ThemeBuilder;
9 10 use Templately\Builder\Types\BaseTemplate;
@@ -10,8 +11,9 @@
10 11 use Templately\Builder\Types\ThemeTemplate;
11 12 use ElementorPro\Modules\ThemeBuilder\Module;
12 13 use Elementor\Core\Files\CSS\Post as Post_CSS;
13 14 use ElementorPro\Plugin;
15 +use Templately\Builder\TemplateLoader;
14 16
15 17 class LocationManager {
16 18 /**
17 19 * @var array<string, ThemeTemplate>
@@ -30,12 +32,8 @@
30 32
31 33 public function __construct( $builder ) {
32 34 $this->builder = $builder;
33 35
34 - /**
35 - * Don't know yet if we need it or not.
36 - */
37 - $this->set_locations();
38 36
39 37 /**
40 38 * Priority is 13,
41 39 * Because it should be run after elementor & woocommerce
@@ -46,12 +44,15 @@
46 44 * Priority is 7,
47 45 * Because it should run before elementor
48 46 */
49 47 add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], 7 );
50 - add_action( 'eb_frontend_assets', [ $this, 'enqueue_template_assets' ], 10, 2 );
48 + add_action( 'wp_enqueue_scripts', [$this, 'enqueue_template_assets'], 8 );
51 49 }
52 50
53 51 private function set_locations() {
52 + if(!empty($this->locations)) {
53 + return;
54 + }
54 55 $this->locations = [
55 56 'header' => [
56 57 'label' => __( 'Header', 'templately' ),
57 58 'multiple' => false
@@ -114,8 +115,11 @@
114 115 $template = $templates_for_location[ $template_id ];
115 116 $page_template = $template->get_meta( '_wp_page_template' );
116 117 $platform = $template->get_platform();
117 118
119 + if( $platform === 'elementor' && !class_exists('Elementor\Plugin') ) {
120 + return $template_path;
121 + }
118 122 if ( ! empty( $platform ) ) {
119 123 $page_template_module->set_platform( $platform );
120 124 }
121 125 $path = $page_template_module->get_template_path( $page_template );
@@ -168,8 +172,15 @@
168 172
169 173 if ( $document_page_template ) {
170 174 $page_template = $document_page_template;
171 175 }
176 +
177 + if(!empty($template_id) && !empty($template) && $template->get_type() == "course_archive"){
178 + // $__post = $GLOBALS['post'];
179 + // learndash_course_grid_load_resources();
180 + // $GLOBALS['post'] = $__post;
181 + $GLOBALS['post'] = get_post($template_id);
182 + }
172 183 }
173 184 }
174 185 $is_header_footer = 'header' === $location || 'footer' === $location;
175 186 if ( empty( $page_template ) && ! $is_header_footer ) {
@@ -226,8 +237,13 @@
226 237 return $locations[ $location ] ?? [];
227 238 }
228 239
229 240 public function get_locations(): array {
241 + /**
242 + * Don't know yet if we need it or not.
243 + */
244 + $this->set_locations();
245 +
230 246 $this->register_locations();
231 247
232 248 return $this->locations;
233 249 }
@@ -275,8 +291,10 @@
275 291 $template->print_content();
276 292 $this->did_locations[] = $location;
277 293
278 294 $this->set_is_printed( $location, $template_id );
295 +
296 + do_action("templately_printed_location", $template_id, $location, $template);
279 297 }
280 298
281 299 return true;
282 300 }
@@ -342,11 +360,11 @@
342 360 }
343 361 }
344 362 }
345 363
346 - public function enqueue_template_assets( $path, $url ) {
364 + public function enqueue_template_assets() {
347 365 $using_templately_builder = get_query_var( 'using_templately_template' );
348 - if ( $using_templately_builder && function_exists( 'templately' ) ) {
366 + if ( ($using_templately_builder || TemplateLoader::is_header_footer()) && function_exists( 'templately' ) ) {
349 367 $template_locations = [ 'header', 'footer', 'archive', 'single' ];
350 368 foreach ( $template_locations as $location ) {
351 369 $template = templately()->theme_builder::$conditions_manager->get_templates_by_location( $location );
352 370 if ( empty( $template ) ) {
@@ -354,14 +372,9 @@
354 372 }
355 373 $template = array_pop( $template );
356 374 if ( $template->platform == 'gutenberg' ) {
357 375 $template = is_array( $template ) ? array_pop( $template ) : $template;
358 - if ( ! file_exists( $path . 'eb-style-' . $template->get_main_id() . '.min.css' ) ) {
359 - $st = EbStyleHandler::init();
360 - $post = get_post( $template->get_main_id() );
361 - $st->eb_write_css_from_content( $post, $post->ID, parse_blocks( $post->post_content ) );
362 - }
363 - wp_enqueue_style( 'templately-' . $location . '-' . $template->get_main_id(), $url . 'eb-style-' . $template->get_main_id() . '.min.css', [], substr( md5( microtime( true ) ), 0, 10 ) );
376 + do_action("templately_printed_location", $template->get_main_id(), $location, $template);
364 377 }
365 378 }
366 379 }
367 380 }