startControlsSection( 'section_shortcode', [ 'label' => __('Shortcode'), ] ); $this->addControl( 'shortcode', [ 'label' => __('Enter your shortcode'), 'type' => ControlsManager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'placeholder' => "{hook h='displayShortcode'}", 'default' => '', ] ); $this->endControlsSection(); } /** * Render shortcode widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { echo do_shortcode($this->getSettings('shortcode')); } protected function renderSmarty() { echo $this->getSettings('shortcode'); } /** * Render shortcode widget as plain content. * * Override the default behavior by printing the shortcode instead of rendering it. * * @since 1.0.0 * @access public */ public function renderPlainContent() { // In plain mode, render without shortcode echo $this->getSettings('shortcode'); } }