'business_field_widget_social', 'description' => __( 'Displays social icons.', 'business-field' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => __( 'Subtitle:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), ); if ( false === has_nav_menu( 'social' ) ) { $fields['message'] = array( 'label' => __( 'Social menu is not set. Please create menu and assign it to Social Menu.', 'business-field' ), 'type' => 'message', 'class' => 'widefat', ); } parent::__construct( 'business-field-social', __( 'BF: Social', 'business-field' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; if ( ! empty( $params['title'] ) ) { echo $args['before_title'] . $params['title'] . $args['after_title']; } if ( ! empty( $params['subtitle'] ) ) { echo '
'; } if ( has_nav_menu( 'social' ) ) { wp_nav_menu( array( 'theme_location' => 'social', 'container' => false, 'depth' => 1, 'link_before' => '', 'link_after' => '', ) ); } echo $args['after_widget']; } } endif; if ( ! class_exists( 'Business_Field_Featured_Page_Widget' ) ) : /** * Featured page widget Class. * * @since 1.0.0 */ class Business_Field_Featured_Page_Widget extends Business_Field_Widget_Base { /** * Sets up a new widget instance. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'business_field_widget_featured_page', 'description' => __( 'Displays single featured Page or Post.', 'business-field' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'use_page_title' => array( 'label' => __( 'Use Page/Post Title as Widget Title', 'business-field' ), 'type' => 'checkbox', 'default' => true, ), 'subtitle' => array( 'label' => __( 'Subtitle:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'featured_page' => array( 'label' => __( 'Select Page:', 'business-field' ), 'type' => 'dropdown-pages', 'show_option_none' => __( '— Select —', 'business-field' ), ), 'id_message' => array( 'label' => '' . _x( 'OR', 'Featured Page Widget', 'business-field' ) . '', 'type' => 'message', ), 'featured_post' => array( 'label' => __( 'Post ID:', 'business-field' ), 'placeholder' => __( 'Eg: 1234', 'business-field' ), 'type' => 'text', 'sanitize_callback' => 'business_field_widget_sanitize_post_id', ), 'content_type' => array( 'label' => __( 'Show Content:', 'business-field' ), 'type' => 'select', 'default' => 'full', 'options' => array( 'excerpt' => __( 'Excerpt', 'business-field' ), 'full' => __( 'Full', 'business-field' ), ), ), 'excerpt_length' => array( 'label' => __( 'Excerpt Length:', 'business-field' ), 'description' => __( 'Applies when Excerpt is selected in Content option.', 'business-field' ), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 100, 'min' => 1, 'max' => 400, ), 'featured_image' => array( 'label' => __( 'Featured Image:', 'business-field' ), 'type' => 'select', 'options' => business_field_get_image_sizes_options(), ), 'featured_image_alignment' => array( 'label' => __( 'Image Alignment:', 'business-field' ), 'type' => 'select', 'default' => 'center', 'options' => business_field_get_image_alignment_options(), ), ); parent::__construct( 'business-field-featured-page', __( 'BF: Featured Page', 'business-field' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; $our_id = ''; if ( absint( $params['featured_post'] ) > 0 ) { $our_id = absint( $params['featured_post'] ); } if ( absint( $params['featured_page'] ) > 0 ) { $our_id = absint( $params['featured_page'] ); } if ( absint( $our_id ) > 0 ) { $qargs = array( 'p' => absint( $our_id ), 'post_type' => 'any', 'no_found_rows' => true, ); $the_query = new WP_Query( $qargs ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); echo ''; } wp_reset_postdata(); } } echo $args['after_widget']; } } endif; if ( ! class_exists( 'Business_Field_Latest_News_Widget' ) ) : /** * Latest news widget Class. * * @since 1.0.0 */ class Business_Field_Latest_News_Widget extends Business_Field_Widget_Base { /** * Sets up a new widget instance. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'business_field_widget_latest_news', 'description' => __( 'Displays latest posts in grid.', 'business-field' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => __( 'Subtitle:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'post_category' => array( 'label' => __( 'Select Category:', 'business-field' ), 'type' => 'dropdown-taxonomies', 'show_option_all' => __( 'All Categories', 'business-field' ), ), 'post_number' => array( 'label' => __( 'Number of Posts:', 'business-field' ), 'type' => 'number', 'default' => 3, 'css' => 'max-width:60px;', 'min' => 1, 'max' => 100, ), 'post_column' => array( 'label' => __( 'Number of Columns:', 'business-field' ), 'type' => 'select', 'default' => 3, 'options' => business_field_get_numbers_dropdown_options( 3, 4 ), ), 'featured_image' => array( 'label' => __( 'Featured Image:', 'business-field' ), 'type' => 'select', 'default' => 'business-field-thumb', 'options' => business_field_get_image_sizes_options(), ), 'excerpt_length' => array( 'label' => __( 'Excerpt Length:', 'business-field' ), 'description' => __( 'in words', 'business-field' ), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 15, 'min' => 1, 'max' => 400, 'adjacent' => true, ), 'more_text' => array( 'label' => __( 'More Text:', 'business-field' ), 'type' => 'text', 'default' => __( 'Know More', 'business-field' ), ), 'disable_date' => array( 'label' => __( 'Disable Date', 'business-field' ), 'type' => 'checkbox', 'default' => false, ), 'disable_excerpt' => array( 'label' => __( 'Disable Excerpt', 'business-field' ), 'type' => 'checkbox', 'default' => false, ), 'disable_more_text' => array( 'label' => __( 'Disable More Text', 'business-field' ), 'type' => 'checkbox', 'default' => false, ), ); parent::__construct( 'business-field-latest-news', __( 'BF: Latest News', 'business-field' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); echo $args['before_widget']; if ( ! empty( $params['title'] ) ) { echo $args['before_title'] . $params['title'] . $args['after_title']; } if ( ! empty( $params['subtitle'] ) ) { echo ''; } $qargs = array( 'posts_per_page' => esc_attr( $params['post_number'] ), 'no_found_rows' => true, ); if ( absint( $params['post_category'] ) > 0 ) { $qargs['cat'] = absint( $params['post_category'] ); } $all_posts = get_posts( $qargs ); ?> 'business_field_widget_call_to_action', 'description' => __( 'Call To Action Widget.', 'business-field' ), 'customize_selective_refresh' => true, ); $fields = array( 'title' => array( 'label' => __( 'Title:', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'primary_button_text' => array( 'label' => __( 'Primary Button Text:', 'business-field' ), 'default' => __( 'Learn more', 'business-field' ), 'type' => 'text', 'class' => 'widefat', ), 'primary_button_url' => array( 'label' => __( 'Primary Button URL:', 'business-field' ), 'type' => 'url', 'class' => 'widefat', ), 'secondary_button_text' => array( 'label' => __( 'Secondary Button Text:', 'business-field' ), 'default' => '', 'type' => 'text', 'class' => 'widefat', ), 'secondary_button_url' => array( 'label' => __( 'Secondary Button URL:', 'business-field' ), 'type' => 'url', 'class' => 'widefat', ), ); parent::__construct( 'business-field-call-to-action', __( 'BF: Call To Action', 'business-field' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); // Add extra classes. $extra_class = 'cta-layout-1'; $args['before_widget'] = implode( 'class="' . $extra_class . ' ', explode( 'class="', $args['before_widget'], 2 ) ); echo $args['before_widget']; echo '