| @@ -32,12 +32,8 @@ | ||
| 32 | 32 | |
| 33 | 33 | public function __construct( $builder ) { |
| 34 | 34 | $this->builder = $builder; |
| 35 | 35 | |
| 36 | - /** | |
| 37 | - * Don't know yet if we need it or not. | |
| 38 | - */ | |
| 39 | - $this->set_locations(); | |
| 40 | 36 | |
| 41 | 37 | /** |
| 42 | 38 | * Priority is 13, |
| 43 | 39 | * Because it should be run after elementor & woocommerce |
| @@ -52,8 +48,11 @@ | ||
| 52 | 48 | add_action( 'wp_enqueue_scripts', [$this, 'enqueue_template_assets'], 8 ); |
| 53 | 49 | } |
| 54 | 50 | |
| 55 | 51 | private function set_locations() { |
| 52 | + if(!empty($this->locations)) { | |
| 53 | + return; | |
| 54 | + } | |
| 56 | 55 | $this->locations = [ |
| 57 | 56 | 'header' => [ |
| 58 | 57 | 'label' => __( 'Header', 'templately' ), |
| 59 | 58 | 'multiple' => false |
| @@ -116,8 +115,11 @@ | ||
| 116 | 115 | $template = $templates_for_location[ $template_id ]; |
| 117 | 116 | $page_template = $template->get_meta( '_wp_page_template' ); |
| 118 | 117 | $platform = $template->get_platform(); |
| 119 | 118 | |
| 119 | + if( $platform === 'elementor' && !class_exists('Elementor\Plugin') ) { | |
| 120 | + return $template_path; | |
| 121 | + } | |
| 120 | 122 | if ( ! empty( $platform ) ) { |
| 121 | 123 | $page_template_module->set_platform( $platform ); |
| 122 | 124 | } |
| 123 | 125 | $path = $page_template_module->get_template_path( $page_template ); |
| @@ -170,8 +172,15 @@ | ||
| 170 | 172 | |
| 171 | 173 | if ( $document_page_template ) { |
| 172 | 174 | $page_template = $document_page_template; |
| 173 | 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 | + } | |
| 174 | 183 | } |
| 175 | 184 | } |
| 176 | 185 | $is_header_footer = 'header' === $location || 'footer' === $location; |
| 177 | 186 | if ( empty( $page_template ) && ! $is_header_footer ) { |
| @@ -228,8 +237,13 @@ | ||
| 228 | 237 | return $locations[ $location ] ?? []; |
| 229 | 238 | } |
| 230 | 239 | |
| 231 | 240 | public function get_locations(): array { |
| 241 | + /** | |
| 242 | + * Don't know yet if we need it or not. | |
| 243 | + */ | |
| 244 | + $this->set_locations(); | |
| 245 | + | |
| 232 | 246 | $this->register_locations(); |
| 233 | 247 | |
| 234 | 248 | return $this->locations; |
| 235 | 249 | } |
| @@ -277,8 +291,10 @@ | ||
| 277 | 291 | $template->print_content(); |
| 278 | 292 | $this->did_locations[] = $location; |
| 279 | 293 | |
| 280 | 294 | $this->set_is_printed( $location, $template_id ); |
| 295 | + | |
| 296 | + do_action("templately_printed_location", $template_id, $location, $template); | |
| 281 | 297 | } |
| 282 | 298 | |
| 283 | 299 | return true; |
| 284 | 300 | } |