| @@ -261,22 +261,11 @@ | ||
| 261 | 261 | $this->end_controls_section(); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | protected function get_dynamic_post_ID() { |
| 265 | - $post_type = 'post'; | |
| 266 | - $type = get_post_meta( get_the_ID(), '_templately_template_type', true ); | |
| 267 | - if($type == 'single') { | |
| 268 | - $post_type = 'post'; | |
| 269 | - } | |
| 270 | - else if($type == 'page_single') { | |
| 271 | - $post_type = 'page'; | |
| 272 | - } | |
| 273 | - else if($type == 'product_single') { | |
| 274 | - $post_type = 'product'; | |
| 275 | - } | |
| 276 | - $latest_cpt = get_posts( "post_type=$post_type&numberposts=1" ); | |
| 265 | + $latest_cpt = get_posts( "post_type=post&numberposts=1" ); | |
| 277 | 266 | |
| 278 | - return Plugin::$instance->editor->is_edit_mode() || isset($_GET['templately_library'], $_GET['preview_id']) ? $latest_cpt[0]->ID : get_the_ID(); | |
| 267 | + return Plugin::$instance->editor->is_edit_mode() || isset( $_GET['preview_id'] ) || isset( $_GET['preview'] ) ? $latest_cpt[0]->ID : get_the_ID(); | |
| 279 | 268 | } |
| 280 | 269 | |
| 281 | 270 | protected function render() { |
| 282 | 271 | $settings = $this->get_settings_for_display(); |