PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.1.3
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.1.3
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 3.1.10 All 111 releases
← All changes | includes/Builder/ThemeBuilder.php +40 -0 3.0.43.1.3 View file →
@@ -56,9 +56,12 @@
56 56 add_action( 'wp_ajax_templately_create_template', [ $this, 'create_template' ] );
57 57
58 58 add_filter( 'elementor/document/config', [$this, 'elementor_document_config'], 10, 2 );
59 59 add_filter( 'elementor/documents/get/post_id', [$this, 'elementor_documents_get_post_id'] );
60 + add_action( 'elementor/widgets/register', [ $this, 'register_elements' ] );
60 61
62 + add_filter( 'the_content', [$this, 'filter_content'], 10 ,1);
63 +
61 64 self::$theme_compatibility = new ThemeCompatibility();
62 65 self::$location_manager = new LocationManager( $this );
63 66 self::$page_template_module = new PageTemplates();
64 67 }
@@ -83,10 +86,17 @@
83 86 public function source_register() {
84 87 self::$templates_manager = new TemplateManager( $this );
85 88 self::$conditions_manager = new ConditionManager( $this );
86 89 self::$source = new Source( $this );
90 + register_rest_field('templately_library','templately_type', [
91 + 'get_callback' => [ $this, 'get_rest_template_type' ],
92 + ]);
87 93 }
88 94
95 + public function get_rest_template_type() {
96 + return get_post_meta( get_the_ID(), '_templately_template_type', true );
97 + }
98 +
89 99 public function create_template() {
90 100 check_admin_referer( 'templately_create_template' );
91 101
92 102 $_type = sanitize_text_field( wp_unslash( $_POST['template_type'] ) );
@@ -186,10 +196,40 @@
186 196 public function modify_template_type( $value, $object_id, $meta_key, $single ) {
187 197 if ( Document::TYPE_META_KEY === $meta_key && Source::CPT === get_post_type( $object_id ) ) {
188 198 remove_filter( 'get_post_metadata', [ $this, 'modify_template_type' ] );
189 199 $value = get_post_meta( $object_id, Source::TYPE_META_KEY, $single );
200 + $arr = [
201 + 'post' => 'single-post',
202 + 'page' => 'single-page',
203 + 'error' => 'error-404',
204 + 'product_single' => 'product',
205 + 'product_archive' => 'product-archive',
206 + 'course_single' => 'single-post',
207 + 'course_archive' => 'archive',
208 + ];
209 + $key = $single ? $value : (isset($value[0]) ? $value[0] : '');
210 + $value = isset( $arr[ $key ] ) ? $arr[ $key ] : $value;
190 211 }
191 212
192 213 return $value;
214 + }
215 +
216 + public function register_elements( $widgets_manager ) {
217 + $widgets_manager->register( new \Templately\Builder\Widgets\Post_Title() );
218 + $widgets_manager->register( new \Templately\Builder\Widgets\Post_Content() );
219 + $widgets_manager->register( new \Templately\Builder\Widgets\Featured_Image() );
220 + $widgets_manager->register( new \Templately\Builder\Widgets\Site_Logo() );
221 + }
222 +
223 + public function filter_content( $content ) {
224 + if(is_singular()){
225 + global $post;
226 + if(!empty($post) && $post->post_type === 'templately_library'){
227 + if(in_array(get_post_meta($post->ID, '_templately_template_type', true), ['header', 'footer'])){
228 + return '';
229 + }
230 + }
231 + }
232 + return $content;
193 233 }
194 234
195 235 }