'business_buzz_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'business-buzz' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-buzz-social', esc_html__( 'BB: Social', 'business-buzz' ), $opts ); } /** * 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 ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); echo $args['before_widget']; // Render widget title. if ( ! empty( $title ) ) { echo $args['before_title'] . $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']; } /** * Update widget instance. * * @since 1.0.0 * * @param array $new_instance New settings for this instance as input by the user. * @param array $old_instance Old settings for this instance. * @return array Settings to save or bool false to cancel saving. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } /** * Output the settings update form. * * @since 1.0.0 * * @param array $instance Current settings. */ function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'title' => '', ) ); ?>

'business_buzz_widget_featured_page', 'description' => esc_html__( 'Displays single featured Page', 'business-buzz' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-buzz-featured-page', esc_html__( 'BB: Featured Page', 'business-buzz' ), $opts ); } /** * 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 ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $featured_page = ! empty( $instance['featured_page'] ) ? $instance['featured_page'] : 0; $content_type = ! empty( $instance['content_type'] ) ? $instance['content_type'] : 'full'; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 80; $featured_image = ! empty( $instance['featured_image'] ) ? $instance['featured_image'] : 'medium'; $featured_image_alignment = ! empty( $instance['featured_image_alignment'] ) ? $instance['featured_image_alignment'] : 'left'; echo $args['before_widget']; if ( absint( $featured_page ) > 0 ) { $qargs = array( 'p' => absint( $featured_page ), 'post_type' => 'page', 'no_found_rows' => true, 'ignore_sticky_posts' => 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' !== $featured_image && has_post_thumbnail() ) { the_post_thumbnail( esc_attr( $featured_image ), array( 'class' => 'align' . esc_attr( $featured_image_alignment ) ) ); } echo ''; } // End while. // Reset. wp_reset_postdata(); } // End if. } echo $args['after_widget']; } /** * Update widget instance. * * @since 1.0.0 * * @param array $new_instance New settings for this instance as input by the user. * @param array $old_instance Old settings for this instance. * @return array Settings to save or bool false to cancel saving. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['featured_page'] = absint( $new_instance['featured_page'] ); $instance['content_type'] = sanitize_key( $new_instance['content_type'] ); $instance['excerpt_length'] = absint( $new_instance['excerpt_length'] ); $instance['featured_image'] = sanitize_text_field( $new_instance['featured_image'] ); $instance['featured_image_alignment'] = sanitize_key( $new_instance['featured_image_alignment'] ); return $instance; } /** * Output the settings update form. * * @since 1.0.0 * * @param array $instance Current settings. */ function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'featured_page' => '', 'content_type' => 'full', 'excerpt_length' => 80, 'featured_image' => 'medium', 'featured_image_alignment' => 'left', ) ); ?>

$this->get_field_id( 'featured_page' ), 'name' => $this->get_field_name( 'featured_page' ), 'selected' => $instance['featured_page'], 'show_option_none' => esc_html__( '— Select —', 'business-buzz' ), ) ); ?>

 

$this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => $instance['featured_image'], ); business_buzz_render_select_dropdown( $dropdown_args, 'business_buzz_get_image_sizes_options' ); ?>

$this->get_field_id( 'featured_image_alignment' ), 'name' => $this->get_field_name( 'featured_image_alignment' ), 'selected' => $instance['featured_image_alignment'], ); business_buzz_render_select_dropdown( $dropdown_args, 'business_buzz_get_image_alignment_options' ); ?>

'business_buzz_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'business-buzz' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-buzz-call-to-action', esc_html__( 'BB: Call To Action', 'business-buzz' ), $opts ); } /** * 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 ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = ! empty( $instance['text'] ) ? $instance['text'] : ''; $primary_button_text = ! empty( $instance['primary_button_text'] ) ? esc_html( $instance['primary_button_text'] ) : ''; $primary_button_url = ! empty( $instance['primary_button_url'] ) ? esc_url( $instance['primary_button_url'] ) : ''; $secondary_button_text = ! empty( $instance['secondary_button_text'] ) ? esc_html( $instance['secondary_button_text'] ) : ''; $secondary_button_url = ! empty( $instance['secondary_button_url'] ) ? esc_url( $instance['secondary_button_url'] ) : ''; $layout = ! empty( $instance['layout'] ) ? absint( $instance['layout'] ) : 1; $background_image = ! empty( $instance['background_image'] ) ? esc_url( $instance['background_image'] ) : ''; // Add background image for layout 2. if ( 2 === absint( $layout ) && ! empty( $background_image ) ) { $background_style = ''; $background_style .= ' style="background-image:url(' . esc_url( $background_image ) . ');" '; $args['before_widget'] = implode( $background_style . ' class="', explode( 'class="', $args['before_widget'], 2 ) ); } // Add layout class. $layout_class = 'cta-layout-' . absint( $layout ); $args['before_widget'] = implode( 'class="' . $layout_class . ' ', explode( 'class="', $args['before_widget'], 2 ) ); echo $args['before_widget']; echo '
'; // Render widget title. if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } ?> '; ?>
'', 'text' => '', 'primary_button_text' => esc_html__( 'Read more', 'business-buzz' ), 'primary_button_url' => home_url( '/' ), 'secondary_button_text' => esc_html__( 'Learn more', 'business-buzz' ), 'secondary_button_url' => home_url( '/' ), 'layout' => '', 'background_image' => '', ) ); ?>

$this->get_field_id( 'layout' ), 'name' => $this->get_field_name( 'layout' ), 'selected' => $instance['layout'], ); business_buzz_render_select_dropdown( $dropdown_args, 'business_buzz_get_numbers_dropdown_options', array( 'min' => 1, 'max' => 2, 'prefix' => esc_html__( 'Layout', 'business-buzz' ) . ' ' ) ); ?>


'business_buzz_widget_latest_news', 'description' => esc_html__( 'Latest News Widget. Displays latest posts in grid.', 'business-buzz' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-buzz-latest-news', esc_html__( 'BB: Latest News', 'business-buzz' ), $opts ); } /** * 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 ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $subtitle = ! empty( $instance['subtitle'] ) ? $instance['subtitle'] : ''; $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; $post_column = ! empty( $instance['post_column'] ) ? $instance['post_column'] : 4; $featured_image = ! empty( $instance['featured_image'] ) ? $instance['featured_image'] : 'business-buzz-thumb'; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 4; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 0; $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : ''; echo $args['before_widget']; // Display widget title. if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } // Display widget subtitle. if ( $subtitle ) { echo '

' . esc_html( $subtitle ) . '

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

0 ) : ?>
'', 'subtitle' => '', 'post_category' => '', 'post_column' => 4, 'featured_image' => 'business-buzz-thumb', 'post_number' => 4, 'excerpt_length' => 40, 'more_text' => esc_html__( 'Read more', 'business-buzz' ), ) ); ?>

'name', 'hide_empty' => true, 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'selected' => $instance['post_category'], 'show_option_all' => esc_html__( 'All Categories','business-buzz' ), ); wp_dropdown_categories( $cat_args ); ?>

$this->get_field_id( 'post_column' ), 'name' => $this->get_field_name( 'post_column' ), 'selected' => $instance['post_column'], ); business_buzz_render_select_dropdown( $dropdown_args, 'business_buzz_get_numbers_dropdown_options', array( 'min' => 3, 'max' => 4 ) ); ?>

$this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => $instance['featured_image'], ); business_buzz_render_select_dropdown( $dropdown_args, 'business_buzz_get_image_sizes_options', array( 'add_disable' => false ) ); ?>

 

block_count = 4; $opts = array( 'classname' => 'business_buzz_widget_services', 'description' => esc_html__( 'Show your services pages with icon and read more link.', 'business-buzz' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-buzz-services', esc_html__( 'BB: Services', 'business-buzz' ), $opts ); } /** * 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 ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $subtitle = ! empty( $instance['subtitle'] ) ? $instance['subtitle'] : ''; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 0; $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : ''; // 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 ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } // Display widget subtitle. if ( $subtitle ) { echo '

' . esc_html( $subtitle ) . '

'; } $services_array = array(); for ( $i = 1; $i <= $this->block_count; $i++ ) { $page = 0; if ( ! empty( $instance[ 'block_page_' . $i ] ) && absint( $instance[ 'block_page_' . $i ] ) > 0 ) { $page = absint( $instance[ 'block_page_' . $i ] ); } if ( $page > 0 ) { $sitem = array(); $sitem['page'] = $page; $sitem['icon'] = ''; if ( ! empty( $instance[ 'block_icon_' . $i ] ) ) { $sitem['icon'] = $instance[ 'block_icon_' . $i ]; } $services_array[] = $sitem; } } // Render content. if ( ! empty( $services_array ) ) { $extra_args = array( 'excerpt_length' => $excerpt_length, 'more_text' => $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() ) { $service_column = count( $services ); $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 ) : ?>
block_count ; $i++ ) { $instance[ 'block_page_' . $i ] = absint( $new_instance[ 'block_page_' . $i ] ); $instance[ 'block_icon_' . $i ] = sanitize_text_field( $new_instance[ 'block_icon_' . $i ] ); } return $instance; } /** * Output the settings update form. * * @since 1.0.0 * * @param array $instance Current settings. */ function form( $instance ) { // Defaults. $widget_defaults = array( 'title' => '', 'subtitle' => '', 'excerpt_length' => 20, 'more_text' => esc_html__( 'Read more', 'business-buzz' ), ); for ( $i = 1; $i <= $this->block_count ; $i++ ) { $widget_defaults[ 'block_page_' . $i ] = ''; $widget_defaults[ 'block_icon_' . $i ] = 'fa-cogs'; } $instance = wp_parse_args( (array) $instance, $widget_defaults ); ?>

 


block_count ; $i++ ) { ?>

$this->get_field_id( 'block_page_' . $i ), 'name' => $this->get_field_name( 'block_page_' . $i ), 'selected' => $instance[ 'block_page_' . $i ], 'show_option_none' => esc_html__( '— Select —', 'business-buzz' ), ) ); ?>