PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.1.2
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.1.2
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/Widgets/Post_Content.php +4 -21 3.7.33.1.2 View file →
@@ -70,22 +70,11 @@
70 70 $this->end_controls_section();
71 71 }
72 72
73 73 protected function get_dynamic_post_ID() {
74 - $post_type = 'post';
75 - $type = get_post_meta( get_the_ID(), '_templately_template_type', true );
76 - if($type == 'single') {
77 - $post_type = 'post';
78 - }
79 - else if($type == 'page_single') {
80 - $post_type = 'page';
81 - }
82 - else if($type == 'product_single') {
83 - $post_type = 'product';
84 - }
85 - $latest_cpt = get_posts( "post_type=$post_type&numberposts=1" );
74 + $latest_cpt = get_posts( "post_type=post&numberposts=1" );
86 75
87 - return Plugin::$instance->editor->is_edit_mode() || isset($_GET['templately_library'], $_GET['preview_id']) ? $latest_cpt[0]->ID : get_the_ID();
76 + return Plugin::$instance->editor->is_edit_mode() || isset( $_GET['preview_id'] ) || isset( $_GET['preview'] ) ? $latest_cpt[0]->ID : get_the_ID();
88 77 }
89 78
90 79 protected function render() {
91 80 static $did_posts = [];
@@ -93,9 +82,9 @@
93 82
94 83 $post = get_post();
95 84
96 85 // Avoid recursion
97 - if ( isset($post, $post->ID) && isset( $did_posts[ $post->ID ] ) ) {
86 + if ( $post && isset( $did_posts[ $post->ID ] ) ) {
98 87 return;
99 88 }
100 89
101 90 $level ++;
@@ -100,11 +89,10 @@
100 89
101 90 $level ++;
102 91 $did_posts[ $post->ID ] = true;
103 92 // End avoid recursion
104 - Plugin::$instance->init_common();
105 - $is_edit_mode = Plugin::$instance->editor->is_edit_mode($post->ID);
106 93
94 + $is_edit_mode = Plugin::$instance->editor->is_edit_mode();
107 95 if ( $is_edit_mode || isset( $_GET['preview_id'] ) || isset( $_GET['preview'] ) ) {
108 96 echo get_the_content( null, null, $this->get_dynamic_post_ID() );
109 97
110 98 return false;
@@ -158,11 +146,6 @@
158 146
159 147 if ( 0 === $level ) {
160 148 $did_posts = [];
161 149 }
162 - }
163 -
164 - // getting infinite loop otherwise
165 - public function render_plain_content() {
166 -
167 150 }
168 151 }