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