controls['template'] = array( 'type' => 'select', 'label' => esc_html__( 'Select Template', 'ultimate-post' ), 'options' => ultimate_post()->get_all_lists( 'ultp_templates' ), 'clearable' => false, 'default' => '', 'pasteStyles' => true, 'inline' => true, ); $this->controls['separator'] = array( 'type' => 'separator', ); $this->controls['help'] = array( 'type' => 'info', 'content' => 'Pick a Template from your saved ones. Or create a template from: Dashboard > PostX > Saved Templates', ); } // Render element HTML public function render() { $id = $this->settings['template']; $root_classes[] = 'bricks-postx-wrapper'; $this->set_attribute( '_root', 'class', $root_classes ); $current_url = isset( $_SERVER['REQUEST_URI'] ) ? esc_url( $_SERVER['REQUEST_URI'] ) : ''; //phpcs:ignore // Render element HTML echo "
render_attributes( '_root' )}>"; //phpcs:ignore if ( $id ) { echo ultimate_post()->build_css_for_inline_print( $id, true ); echo '
'; $args = array( 'p' => $id, 'post_type' => 'ultp_templates', ); $the_query = new \WP_Query( $args ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); the_content(); } wp_reset_postdata(); } echo '
'; } elseif ( strpos( 'bricks=run', $current_url ) !== false || strpos( $current_url, 'bricks/v1/render_element' ) !== false ) { echo '

' . sprintf( esc_html__( 'Pick a Template from your saved ones. Or create a template from: %s.', 'ultimate-post' ) . ' ', '' . esc_html__( 'Dashboard > PostX > Saved Templates', 'ultimate-post' ) . '' ) . '

'; } echo '
'; } }