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