'best_business_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), ); parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } 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( 'Best_Business_Featured_Page_Widget' ) ) : /** * Featured page widget class. * * @since 1.0.0 */ class Best_Business_Featured_Page_Widget extends Best_Business_Widget_Helper { /** * Constructor. * * @since 1.0.0 */ function __construct() { $args['id'] = 'best-business-featured-page'; $args['label'] = esc_html__( 'BB: Featured Page', 'best-business' ); $args['widget'] = array( 'classname' => 'best_business_widget_featured_page', 'description' => esc_html__( 'Displays single featured Page', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'featured_page' => array( 'label' => esc_html__( 'Select Page:', 'best-business' ), 'type' => 'dropdown-pages', 'show_option_none' => esc_html__( '— Select —', 'best-business' ), ), 'content_type' => array( 'label' => esc_html__( 'Show Content:', 'best-business' ), 'type' => 'select', 'default' => 'full', 'choices' => array( 'short' => esc_html__( 'Short', 'best-business' ), 'full' => esc_html__( 'Full', 'best-business' ), ), ), 'excerpt_length' => array( 'label' => esc_html__( 'Excerpt Length:', 'best-business' ), 'description' => esc_html__( 'Applies when Short is selected in Show Content.', 'best-business' ), 'type' => 'number', 'default' => 40, 'min' => 1, 'max' => 100, 'style' => 'max-width:60px;', ), 'featured_image' => array( 'label' => esc_html__( 'Select Image:', 'best-business' ), 'type' => 'select', 'default' => 'medium', 'choices' => best_business_get_image_sizes_options(), ), 'featured_image_alignment' => array( 'label' => esc_html__( 'Select Image Alignment:', 'best-business' ), 'type' => 'select', 'default' => 'left', 'choices' => best_business_get_image_alignment_options(), ), ); parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; if ( absint( $values['featured_page'] ) > 0 ) { $qargs = array( 'p' => absint( $values['featured_page'] ), 'post_type' => 'page', 'no_found_rows' => true, ); $the_query = new WP_Query( $qargs ); if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); // Display featured image. if ( 'disable' !== $values['featured_image'] && has_post_thumbnail() ) { the_post_thumbnail( esc_attr( $values['featured_image'] ), array( 'class' => 'align' . esc_attr( $values['featured_image_alignment'] ) ) ); } echo ''; } // End while. // Reset. wp_reset_postdata(); } // End if. } echo $args['after_widget']; } } endif; if ( ! class_exists( 'Best_Business_Pages_Blocks_Widget' ) ) : /** * Pages Blocks widget class. * * @since 1.0.0 */ class Best_Business_Pages_Blocks_Widget extends Best_Business_Widget_Helper { /** * Block count. * * @since 1.0.0 * * @var int Block count. */ protected $block_count; /** * Constructor. * * @since 1.0.0 */ function __construct() { $this->block_count = 3; $args['id'] = 'best-business-pages-blocks'; $args['label'] = esc_html__( 'BB: Pages Blocks', 'best-business' ); $args['widget'] = array( 'classname' => 'best_business_widget_pages_blocks', 'description' => esc_html__( 'Displays pages blocks.', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => esc_html__( 'Subtitle:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'featured_image' => array( 'label' => esc_html__( 'Featured Image:', 'best-business' ), 'type' => 'select', 'default' => 'medium', 'choices' => best_business_get_image_sizes_options(), ), 'excerpt_length' => array( 'label' => esc_html__( 'Excerpt Length:', 'best-business' ), 'description' => esc_html__( 'Number of words. Enter 0 to disable.', 'best-business' ), 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 500, 'style' => 'max-width:60px;', ), 'more_text' => array( 'label' => esc_html__( 'Read More Text:', 'best-business' ), 'class' => 'widefat', 'type' => 'text', 'default' => esc_html__( 'Read more', 'best-business' ), ), 'pages_blocks_separator' => array( 'label' => '', 'type' => 'separator', ), ); for ( $i = 1; $i <= $this->block_count ; $i++ ) { $block_fields[ 'block_page_' . $i ] = array( 'label' => sprintf( esc_html__( 'Page - %d:', 'best-business' ), $i ), 'type' => 'dropdown-pages', 'show_option_none' => esc_html__( '— Select —', 'best-business' ), ); $args['fields'] = array_merge( $args['fields'], $block_fields ); } parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } // Render widget subtitle. if ( ! empty( $values['subtitle'] ) ) { echo '

' . esc_html( $values['subtitle'] ) . '

'; } $pages_array = array(); for ( $i = 1; $i <= $this->block_count; $i++ ) { $page = 0; if ( ! empty( $values[ 'block_page_' . $i ] ) && absint( $values[ 'block_page_' . $i ] ) > 0 ) { $page = absint( $values[ 'block_page_' . $i ] ); } if ( $page > 0 ) { $pages_array[] = absint( $values[ 'block_page_' . $i ] ); } if ( ! empty( $pages_array ) ) { $pages_array = array_unique( $pages_array ); } } // Render content. if ( ! empty( $pages_array ) ) { $extra_args = array( 'featured_image' => $values['featured_image'], 'excerpt_length' => $values['excerpt_length'], 'more_text' => $values['more_text'], ); $this->render_widget_content( $pages_array, $extra_args ); } echo $args['after_widget']; } /** * Render content. * * @since 1.0.0 * * @param array $pages Pages. * @param array $args Arguments. */ function render_widget_content( $pages, $args ) { $qargs = array( 'no_found_rows' => true, 'orderby' => 'post__in', 'post__in' => $pages, 'post_type' => 'page', 'posts_per_page' => count( $pages ), ); $the_query = new WP_Query( $qargs ); ?> have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
'best_business_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'text' => array( 'label' => esc_html__( 'Text:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'primary_button_text' => array( 'label' => esc_html__( 'Primary Button Text:', 'best-business' ), 'default' => esc_html__( 'Learn more', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'primary_button_url' => array( 'label' => esc_html__( 'Primary Button URL:', 'best-business' ), 'type' => 'url', 'default' => '#', 'class' => 'widefat', ), 'secondary_button_text' => array( 'label' => esc_html__( 'Secondary Button Text:', 'best-business' ), 'default' => '', 'type' => 'text', 'class' => 'widefat', ), 'secondary_button_url' => array( 'label' => esc_html__( 'Secondary Button URL:', 'best-business' ), 'type' => 'url', 'class' => 'widefat', ), 'layout' => array( 'label' => esc_html__( 'Select Layout:', 'best-business' ), 'type' => 'select', 'default' => 1, 'choices' => best_business_get_numbers_dropdown_options( 1, 2, esc_html__( 'Layout', 'best-business' ) . ' ' ), ), 'background_image' => array( 'label' => esc_html__( 'Background Image:', 'best-business' ), 'description' => sprintf( esc_html__( 'Background Image applies to Layout 2 only. Recommended image size: %1$dpx X %2$dpx', 'best-business' ), 1920, 600 ), 'type' => 'image', ), ); parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); // Add background image for layout 2. if ( 2 === absint( $values['layout'] ) && ! empty( $values['background_image'] ) ) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url( $values['background_image'] ) . ');" '; $args['before_widget'] = implode( $background_style . ' class="', explode( 'class="', $args['before_widget'], 2 ) ); } // Add layout class. $layout_class = 'cta-layout-' . absint( $values['layout'] ); $args['before_widget'] = implode( 'class="' . $layout_class . ' ', explode( 'class="', $args['before_widget'], 2 ) ); echo $args['before_widget']; echo '
'; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } if ( ! empty( $values['text'] ) ) { echo wp_kses_post( wpautop( $values['text'] ) ); } echo '
'; ?>
'best_business_widget_advanced_recent_posts', 'description' => esc_html__( 'Advanced Recent Posts Widget. Displays recent posts with thumbnail.', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'post_category' => array( 'label' => esc_html__( 'Select Category:', 'best-business' ), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__( 'All Categories', 'best-business' ), ), 'featured_image' => array( 'label' => esc_html__( 'Featured Image:', 'best-business' ), 'type' => 'select', 'default' => 'thumbnail', 'choices' => best_business_get_image_sizes_options( true, array( 'disable', 'thumbnail' ), false ), ), 'image_width' => array( 'label' => esc_html__( 'Image Width:', 'best-business' ), 'description' => esc_html__( 'px', 'best-business' ), 'type' => 'number', 'default' => 90, 'min' => 1, 'max' => 150, 'style' => 'max-width:60px;', 'newline' => false, ), 'post_number' => array( 'label' => esc_html__( 'No of Posts:', 'best-business' ), 'type' => 'number', 'default' => 4, 'min' => 1, 'max' => 50, 'style' => 'max-width:60px;', ), 'excerpt_length' => array( 'label' => esc_html__( 'Excerpt Length:', 'best-business' ), 'description' => esc_html__( 'Number of words. Enter 0 to disable.', 'best-business' ), 'type' => 'number', 'default' => 10, 'min' => 0, 'max' => 100, 'style' => 'max-width:60px;', ), 'disable_date' => array( 'label' => esc_html__( 'Disable Date', 'best-business' ), 'type' => 'checkbox', 'default' => false, ), ); parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } ?> absint( $values['post_number'] ), 'no_found_rows' => true, 'ignore_sticky_posts' => true, ); if ( absint( $values['post_category'] ) > 0 ) { $qargs['cat'] = $values['post_category']; } $the_query = new WP_Query( $qargs ); ?> have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>

0 ) : ?>
'best_business_widget_latest_news', 'description' => esc_html__( 'Latest News Widget. Displays latest posts in grid.', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => esc_html__( 'Subtitle:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'post_category' => array( 'label' => esc_html__( 'Select Category:', 'best-business' ), 'type' => 'dropdown-taxonomies', 'show_option_all' => esc_html__( 'All Categories', 'best-business' ), ), 'post_column' => array( 'label' => esc_html__( 'No of Columns:', 'best-business' ), 'type' => 'select', 'default' => 3, 'choices' => best_business_get_numbers_dropdown_options( 1, 4 ), 'style' => 'min-width:40px;', ), 'featured_image' => array( 'label' => esc_html__( 'Featured Image:', 'best-business' ), 'type' => 'select', 'default' => 'best-business-thumb', 'choices' => best_business_get_image_sizes_options(), ), 'post_number' => array( 'label' => esc_html__( 'No of Posts:', 'best-business' ), 'type' => 'number', 'default' => 3, 'min' => 1, 'max' => 100, 'style' => 'max-width:60px;', ), 'excerpt_length' => array( 'label' => esc_html__( 'Excerpt Length:', 'best-business' ), 'description' => esc_html__( 'Number of words. Enter 0 to disable.', 'best-business' ), 'type' => 'number', 'default' => 20, 'min' => 0, 'max' => 300, 'style' => 'max-width:60px;', ), 'more_text' => array( 'label' => esc_html__( 'Read More Text:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__( 'Read more', 'best-business' ), ), ); parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } // Render widget subtitle. if ( ! empty( $values['subtitle'] ) ) { echo '

' . esc_html( $values['subtitle'] ) . '

'; } $qargs = array( 'posts_per_page' => absint( $values['post_number'] ), 'no_found_rows' => true, 'ignore_sticky_posts' => true, ); if ( absint( $values['post_category'] ) > 0 ) { $qargs['cat'] = absint( $values['post_category'] ); } $the_query = new WP_Query( $qargs ); ?> have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
'; comments_popup_link( '' . esc_html__( '0 Comment', 'best-business' ) . '', esc_html__( '1 Comment', 'best-business' ), esc_html__( '% Comments', 'best-business' ) ); echo ''; } ?>

0 ) : ?>
block_count = 6; $args['id'] = 'best-business-services'; $args['label'] = esc_html__( 'BB: Services', 'best-business' ); $args['widget'] = array( 'classname' => 'best_business_widget_services', 'description' => esc_html__( 'Displays services pages with icon and read more link.', 'best-business' ), 'customize_selective_refresh' => true, ); $args['fields'] = array( 'title' => array( 'label' => esc_html__( 'Title:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'subtitle' => array( 'label' => esc_html__( 'Subtitle:', 'best-business' ), 'type' => 'text', 'class' => 'widefat', ), 'excerpt_length' => array( 'label' => esc_html__( 'Excerpt Length:', 'best-business' ), 'description' => esc_html__( 'Number of words. Enter 0 to disable.', 'best-business' ), 'type' => 'number', 'default' => 15, 'min' => 0, 'max' => 400, 'style' => 'max-width:60px;', ), 'more_text' => array( 'label' => esc_html__( 'Read More Text:', 'best-business' ), 'type' => 'text', 'default' => esc_html__( 'Read more', 'best-business' ), 'class' => 'widefat', ), ); for ( $i = 1; $i <= $this->block_count ; $i++ ) { $block_fields[ 'heading_' . $i ] = array( 'label' => sprintf( esc_html__( 'Block %d', 'best-business' ), $i ), 'type' => 'heading', ); $block_fields[ 'block_page_' . $i ] = array( 'label' => esc_html__( 'Page:', 'best-business' ), 'type' => 'dropdown-pages', 'show_option_none' => esc_html__( '— Select —', 'best-business' ), ); $block_fields[ 'block_icon_' . $i ] = array( 'label' => esc_html__( 'Icon:', 'best-business' ), 'type' => 'text', 'default' => 'fa-cogs', 'placeholder' => esc_html__( 'eg: fa-cogs', 'best-business' ), ); if ( 1 === $i ) { $block_fields[ 'message_' . $i ] = array( 'label' => '' . esc_html__( 'View Font Awesome Reference', 'best-business' ) . '', 'type' => 'message', ); } $args['fields'] = array_merge( $args['fields'], $block_fields ); } parent::create_widget( $args ); } /** * Echo the widget content. * * @since 1.0.0 * * @param array $args Display arguments including before_title, after_title, * before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget. */ function widget( $args, $instance ) { $values = $this->get_field_values( $instance ); $values['title'] = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); // Add layout class. $layout_class = 'services-layout-1'; $args['before_widget'] = implode( 'class="' . $layout_class . ' ', explode( 'class="', $args['before_widget'], 2 ) ); echo $args['before_widget']; // Render widget title. if ( ! empty( $values['title'] ) ) { echo $args['before_title'] . esc_html( $values['title'] ) . $args['after_title']; } // Render widget subtitle. if ( ! empty( $values['subtitle'] ) ) { echo '

' . esc_html( $values['subtitle'] ) . '

'; } $services_array = array(); for ( $i = 1; $i <= $this->block_count; $i++ ) { $page = 0; if ( ! empty( $values[ 'block_page_' . $i ] ) && absint( $values[ 'block_page_' . $i ] ) > 0 ) { $page = absint( $values[ 'block_page_' . $i ] ); } if ( $page > 0 ) { $sitem = array(); $sitem['page'] = $page; $sitem['icon'] = ''; if ( ! empty( $values[ 'block_icon_' . $i ] ) ) { $sitem['icon'] = $values[ 'block_icon_' . $i ]; } $services_array[] = $sitem; } } // Render content. if ( ! empty( $services_array ) ) { $extra_args = array( 'excerpt_length' => $values['excerpt_length'], 'more_text' => $values['more_text'], ); $this->render_widget_content( $services_array, $extra_args ); } echo $args['after_widget']; } /** * Render services. * * @since 1.0.0 * * @param array $services Services details. * @param array $args Arguments. */ function render_widget_content( $services, $args = array() ) { global $post; $ids = wp_list_pluck( $services, 'page' ); $qargs = array( 'post_type' => 'page', 'no_found_rows' => true, 'post__in' => $ids, 'posts_per_page' => count( $ids ), 'orderby' => 'post__in', 'ignore_sticky_posts' => true, ); $the_query = new WP_Query( $qargs ); if ( ! $the_query->have_posts() ) { return; } ?>
have_posts() ) : $the_query->the_post(); ?> get_the_ID() ), 'and', 'icon' ); $icon = array_shift( $icon_item ); ?>

0 ) : ?>