'sp_post_carousel', 'post_status' => 'publish', 'posts_per_page' => 10000, ) ); $posts = $sp_pcp_posts->posts; foreach ( $posts as $post ) { $post_list[ $post->ID ] = $post->post_title; } krsort( $post_list ); return $post_list; } /** * Controls register. * * @return void */ protected function _register_controls() { $this->start_controls_section( 'content_section', array( 'label' => __( 'Content', 'post-carousel' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'sp_smart_post_show_free_shortcode', array( 'label' => __( 'Smart Post Show Shortcode(s)', 'post-carousel' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'default' => '', 'options' => $this->sp_pcp_post_list(), ) ); $this->end_controls_section(); } /** * Render smart post show free shortcode widget output on the frontend. * * @since 2.4.1 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $sp_pcp_shortcode = $settings['sp_smart_post_show_free_shortcode']; if ( '' === $sp_pcp_shortcode ) { echo '
Select a shortcode
'; return; } $generator_id = $sp_pcp_shortcode; if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { $pcp_gl_id = $generator_id; // Smart Post Show global ID for Shortcode metaboxes. // Preset Layouts. $layout = get_post_meta( $pcp_gl_id, 'sp_pcp_layouts', true ); // All the visible options for the Shortcode like – Global, Filter, Display, Popup, Typography etc. $view_options = get_post_meta( $pcp_gl_id, 'sp_pcp_view_options', true ); $section_title = get_the_title( $pcp_gl_id ); SP_PC_Output::pc_html_show( $view_options, $layout, $pcp_gl_id, $section_title ); ?>