PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.4.4
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.4.4
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 +26 -1 3.0.93.4.4 View file →
@@ -56,8 +56,9 @@
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
61 62 add_filter( 'the_content', [$this, 'filter_content'], 10 ,1);
62 63
63 64 self::$theme_compatibility = new ThemeCompatibility();
@@ -85,13 +86,26 @@
85 86 public function source_register() {
86 87 self::$templates_manager = new TemplateManager( $this );
87 88 self::$conditions_manager = new ConditionManager( $this );
88 89 self::$source = new Source( $this );
90 + register_rest_field('templately_library','templately_type', [
91 + 'get_callback' => [ $this, 'get_rest_template_type' ],
92 + ]);
89 93 }
90 94
95 + public function get_rest_template_type() {
96 + return get_post_meta( get_the_ID(), '_templately_template_type', true );
97 + }
98 +
91 99 public function create_template() {
92 100 check_admin_referer( 'templately_create_template' );
93 101
102 + // Check user capability
103 + if (!current_user_can('delete_posts')) {
104 + wp_send_json_error(['message' => 'Insufficient permissions']);
105 + wp_die();
106 + }
107 +
94 108 $_type = sanitize_text_field( wp_unslash( $_POST['template_type'] ) );
95 109
96 110 $_meta = [];
97 111
@@ -185,9 +199,10 @@
185 199 return $post_id;
186 200 }
187 201
188 202 public function modify_template_type( $value, $object_id, $meta_key, $single ) {
189 - if ( Document::TYPE_META_KEY === $meta_key && Source::CPT === get_post_type( $object_id ) ) {
203 + $_value = $value;
204 + if ( empty($value) && Document::TYPE_META_KEY === $meta_key && Source::CPT === get_post_type( $object_id ) ) {
190 205 remove_filter( 'get_post_metadata', [ $this, 'modify_template_type' ] );
191 206 $value = get_post_meta( $object_id, Source::TYPE_META_KEY, $single );
192 207 $arr = [
193 208 'post' => 'single-post',
@@ -199,11 +214,21 @@
199 214 'course_archive' => 'archive',
200 215 ];
201 216 $key = $single ? $value : (isset($value[0]) ? $value[0] : '');
202 217 $value = isset( $arr[ $key ] ) ? $arr[ $key ] : $value;
218 + if(in_array($value, ['header', 'footer'])){
219 + return $_value;
220 + }
203 221 }
204 222
205 223 return $value;
224 + }
225 +
226 + public function register_elements( $widgets_manager ) {
227 + $widgets_manager->register( new \Templately\Builder\Widgets\Post_Title() );
228 + $widgets_manager->register( new \Templately\Builder\Widgets\Post_Content() );
229 + $widgets_manager->register( new \Templately\Builder\Widgets\Featured_Image() );
230 + $widgets_manager->register( new \Templately\Builder\Widgets\Site_Logo() );
206 231 }
207 232
208 233 public function filter_content( $content ) {
209 234 if(is_singular()){