start_controls_section( 'project_card', [ 'label' => esc_html__( 'Thinkai Project Card', 'thinkai' ), ] ); //BG Image $this->add_control( 'feature_image', [ 'label' => __( 'Feature Image Url', 'thinkai' ), 'type' => Controls_Manager::MEDIA, 'default' => ['url' => Utils::get_placeholder_image_src(),], ] ); //Title $this->add_control( 'title', [ 'label' => __( 'Title', 'thinkai' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Image Generator', 'thinkai' ), ] ); //Text $this->add_control( 'text', [ 'label' => __( 'Description', 'thinkai' ), 'type' => Controls_Manager::TEXTAREA, 'label_block' => true, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Convert text to image.', 'thinkai' ), ] ); //External Link $this->add_control( 'link_option', [ 'label' => esc_html__( 'Select link Option', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'extranal', 'options' => array( 'extranal' => esc_html__( 'Extranal ', 'thinkai'), 'page' => esc_html__( 'Page ', 'thinkai'), ), ] ); $this->add_control( 'link', [ 'label' => __( 'External Link', 'thinkai' ), 'type' => Controls_Manager::URL, 'label_block' => true, 'placeholder' => __( 'https://your-link.com', 'thinkai' ), 'show_external' => true, 'default' => [ 'url' => '', 'is_external' => true, 'nofollow' => true, ], 'condition' => [ 'link_option' => 'extranal' ] ] ); $this->add_control( 'page_select', [ 'label' => esc_html__( 'Select Page', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT2, 'default' => 'extranal', 'options' => thinkai_page_list(), 'condition' => [ 'link_option' => 'page' ] ] ); $this->end_controls_section(); } /** * Render button widget output on the frontend. * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $allowed_tags = wp_kses_allowed_html('post'); $page = $settings['link_option']; $page_select = $settings[ 'page_select' ]; $ext_url = $settings[ 'link' ]; if( $page == 'page' ){ $mount_link = get_page_link( $page_select ); }else{ $mount_link = $ext_url['url']; $target = $ext_url['is_external'] ? ' target="_blank"' : ''; $nofollow = $ext_url['nofollow'] ? ' rel="nofollow"' : ''; } ?>
<?php bloginfo( 'name' ); ?>