'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 '
$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' ) . ' ' ) ); ?>
'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 '
$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' ), ) ); ?>