'business_club_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-social', esc_html__( 'Business Club: Social', 'business-club' ), $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 title. if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } $nav_menu_locations = get_nav_menu_locations(); $menu_id = 0; if ( isset( $nav_menu_locations['social'] ) && absint( $nav_menu_locations['social'] ) > 0 ) { $menu_id = absint( $nav_menu_locations['social'] ); } if ( $menu_id > 0 ) { $menu_items = wp_get_nav_menu_items( $menu_id ); if ( ! empty( $menu_items ) ) { echo ''; } } 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 via * {@see WP_Widget::form()}. * @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' => '', ) ); $title = esc_attr( $instance['title'] ); // Fetch navigation. $nav_menu_locations = get_nav_menu_locations(); $is_menu_set = false; if ( isset( $nav_menu_locations['social'] ) && absint( $nav_menu_locations['social'] ) > 0 ) { $is_menu_set = true; } ?>

'business_club_widget_featured_page', 'description' => esc_html__( 'Displays single featured Page or Post', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-featured-page', esc_html__( 'Business Club: Featured Page', 'business-club' ), $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 ); $use_page_title = ! empty( $instance['use_page_title'] ) ? $instance['use_page_title'] : false ; $featured_page = ! empty( $instance['featured_page'] ) ? $instance['featured_page'] : 0; $featured_post = ! empty( $instance['featured_post'] ) ? $instance['featured_post'] : 0; $content_type = ! empty( $instance['content_type'] ) ? $instance['content_type'] : 'full'; $featured_image = ! empty( $instance['featured_image'] ) ? $instance['featured_image'] : 'disable'; $featured_image_alignment = ! empty( $instance['featured_image_alignment'] ) ? $instance['featured_image_alignment'] : 'left'; // ID validation. $our_post_object = null; $our_id = ''; if ( absint( $featured_post ) > 0 ) { $our_id = absint( $featured_post ); } if ( absint( $featured_page ) > 0 ) { $our_id = absint( $featured_page ); } if ( absint( $our_id ) > 0 ) { $raw_object = get_post( $our_id ); if ( ! in_array( $raw_object->post_type, array( 'attachment', 'nav_menu_item', 'revision' ) ) ) { $our_post_object = $raw_object; } } if ( ! $our_post_object ) { // No valid object; bail now! return; } global $post; // Setup global post $post = $our_post_object; setup_postdata( $post ); // Override title if checkbox is selected. if ( true === $use_page_title ) { $title = get_the_title( $post ); } echo $args['before_widget']; // Render title. if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } // 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 ) ) ); } ?>
'', 'use_page_title' => 1, 'featured_page' => '', 'featured_post' => '', 'content_type' => 'full', 'featured_image' => 'disable', 'featured_image_alignment' => 'left', ) ); $title = esc_attr( $instance['title'] ); $use_page_title = esc_attr( $instance['use_page_title'] ); $featured_page = absint( $instance['featured_page'] ); $featured_post = esc_attr( $instance['featured_post'] ); $content_type = esc_attr( $instance['content_type'] ); $featured_image = esc_attr( $instance['featured_image'] ); $featured_image_alignment = esc_attr($instance['featured_image_alignment']); ?>

/> 

$this->get_field_id( 'featured_page' ), 'name' => $this->get_field_name( 'featured_page' ), 'selected' => $featured_page, 'show_option_none' => __( '— Select —', 'business-club' ), ) ); ?>

dropdown_image_sizes( array( 'id' => $this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => $featured_image, ) ); ?>

$this->get_field_id( 'featured_image_alignment' ), 'name' => $this->get_field_name( 'featured_image_alignment' ), 'selected' => $featured_image_alignment, ); business_club_render_select_dropdown( $dropdown_args, 'business_club_get_image_alignment_options' ); ?>

'', 'name' => '', 'selected' => 0, 'echo' => 1, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = business_club_get_image_sizes_options(); if ( ! empty( $choices ) ) { $output = "\n"; } if ( $r['echo'] ) { echo $output; } return $output; } } endif; if ( ! class_exists( 'Business_Club_Call_To_Action_Widget' ) ) : /** * Call To Action widget Class. * * @since 1.0.0 */ class Business_Club_Call_To_Action_Widget extends WP_Widget { /** * Constructor. * * @since 1.0.0 */ function __construct() { $opts = array( 'classname' => 'business_club_widget_call_to_action', 'description' => esc_html__( 'Call To Action Widget', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-call-to-action', esc_html__( 'Business Club: Call To Action', 'business-club' ), $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'] ) : ''; $open_url_in_new_window = ! empty( $instance['open_url_in_new_window'] ) ? $instance['open_url_in_new_window'] : false ; echo $args['before_widget']; // Render title. if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title']; } ?>
class="button cta-button cta-button-primary">
'', 'text' => '', 'filter' => 1, 'primary_button_text' => esc_html__( 'Read more', 'business-club' ), 'primary_button_url' => '', 'open_url_in_new_window' => 0, ) ); $title = esc_attr( $instance['title'] ); $text = esc_textarea( $instance['text'] ); $filter = esc_attr( $instance['filter'] ); $primary_button_text = esc_attr( $instance['primary_button_text'] ); $primary_button_url = esc_url( $instance['primary_button_url'] ); $open_url_in_new_window = esc_attr( $instance['open_url_in_new_window'] ); ?>

/> 

/> 

'business_club_widget_advanced_recent_posts', 'description' => __( 'Advanced Recent Posts Widget. Displays recent posts with thumbnail.', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-advanced-recent-posts', __( 'Business Club: Recent Posts Advanced', 'business-club' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; $featured_image = ! empty( $instance['featured_image'] ) ? $instance['featured_image'] : 'thumbnail'; $image_width = ! empty( $instance['image_width'] ) ? $instance['image_width'] : 90; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 4; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 10; $disable_date = ! empty( $instance['disable_date'] ) ? $instance['disable_date'] : false ; $disable_comment = ! empty( $instance['disable_comment'] ) ? $instance['disable_comment'] : false ; $disable_excerpt = ! empty( $instance['disable_excerpt'] ) ? $instance['disable_excerpt'] : false ; echo $args['before_widget']; // Title if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } ?> esc_attr( $post_number ), 'no_found_rows' => true, ); if ( absint( $post_category ) > 0 ) { $qargs['category'] = $post_category; } $all_posts = get_posts( $qargs ); ?>
$post ) : ?>

'', 'post_category' => '', 'featured_image' => 'thumbnail', 'image_width' => 90, 'post_number' => 4, 'excerpt_length' => 10, 'disable_date' => 0, 'disable_excerpt' => 1, ) ); $title = esc_attr( $instance['title'] ); $post_category = absint( $instance['post_category'] ); $featured_image = esc_attr( $instance['featured_image'] ); $image_width = absint( $instance['image_width'] ); $post_number = absint( $instance['post_number'] ); $excerpt_length = absint( $instance['excerpt_length'] ); $disable_date = esc_attr( $instance['disable_date'] ); $disable_excerpt = esc_attr( $instance['disable_excerpt'] ); ?>

'name', 'hide_empty' => 0, 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'selected' => $post_category, 'show_option_all' => __( 'All Categories','business-club' ), ); wp_dropdown_categories( $cat_args ); ?>

dropdown_image_sizes( array( 'id' => $this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => $featured_image, ) ); ?>

 

 

/> 

/> 

'', 'name' => '', 'selected' => 0, 'echo' => 1, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = business_club_get_image_sizes_options( true, array( 'thumbnail', 'disable' ), false ); if ( ! empty( $choices ) ) { $output = "\n"; } if ( $r['echo'] ) { echo $output; } return $output; } } endif; if ( ! class_exists( 'Business_Club_Latest_News_Widget' ) ) : /** * Latest News Widget Class * * @since 1.0.0 */ class Business_Club_Latest_News_Widget extends WP_Widget { function __construct() { $opts = array( 'classname' => 'business_club_widget_latest_news', 'description' => __( 'Latest News Widget. Displays latest posts in grid.', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-latest-news', esc_html__( 'Business Club: Latest News', 'business-club' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $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'] : 'medium'; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 40; $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : __( 'Read more','business-club' ); $disable_date = ! empty( $instance['disable_date'] ) ? $instance['disable_date'] : false ; $disable_comment = ! empty( $instance['disable_comment'] ) ? $instance['disable_comment'] : false ; $disable_excerpt = ! empty( $instance['disable_excerpt'] ) ? $instance['disable_excerpt'] : false ; $disable_more_text = ! empty( $instance['disable_more_text'] ) ? $instance['disable_more_text'] : false ; echo $args['before_widget']; // Title. if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } ?> esc_attr( $post_column ), 'no_found_rows' => true, ); if ( absint( $post_category ) > 0 ) { $qargs['category'] = absint( $post_category ); } $all_posts = get_posts( $qargs ); ?>
$post ) : ?>

'; comments_popup_link( '' . __( 'No Comment', 'business-club' ) . '', __( '1 Comment', 'business-club' ), __( '% Comments', 'business-club' ) ); echo ''; } ?>

'', 'post_category' => '', 'post_column' => 4, 'featured_image' => 'medium', 'excerpt_length' => 40, 'more_text' => __( 'Read more', 'business-club' ), 'disable_date' => 0, 'disable_comment' => 0, 'disable_excerpt' => 0, 'disable_more_text' => 0, ) ); $title = esc_attr( $instance['title'] ); $post_category = absint( $instance['post_category'] ); $post_column = absint( $instance['post_column'] ); $featured_image = esc_attr( $instance['featured_image'] ); $excerpt_length = absint( $instance['excerpt_length'] ); $more_text = sanitize_text_field( $instance['more_text'] ); $disable_date = esc_attr( $instance['disable_date'] ); $disable_comment = esc_attr( $instance['disable_comment'] ); $disable_excerpt = esc_attr( $instance['disable_excerpt'] ); $disable_more_text = esc_attr( $instance['disable_more_text'] ); ?>

'name', 'hide_empty' => 0, 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'selected' => $post_category, 'show_option_all' => __( 'All Categories','business-club' ), ); wp_dropdown_categories( $cat_args ); ?>

dropdown_post_columns( array( 'id' => $this->get_field_id( 'post_column' ), 'name' => $this->get_field_name( 'post_column' ), 'selected' => $post_column, ) ); ?>

dropdown_image_sizes( array( 'id' => $this->get_field_id( 'featured_image' ), 'name' => $this->get_field_name( 'featured_image' ), 'selected' => $featured_image, ) ); ?>

 

/> 

/> 

/> 

/> 

'', 'name' => '', 'selected' => 0, 'echo' => 1, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = array( '3' => 3, '4' => 4, ); if ( ! empty( $choices ) ) { $output = "\n"; } if ( $r['echo'] ) { echo $output; } return $output; } function dropdown_image_sizes( $args ) { $defaults = array( 'id' => '', 'name' => '', 'selected' => 0, 'echo' => 1, ); $r = wp_parse_args( $args, $defaults ); $output = ''; $choices = business_club_get_image_sizes_options( true, array( 'disable', 'thumbnail', 'medium' ), false ); if ( ! empty( $choices ) ) { $output = "\n"; } if ( $r['echo'] ) { echo $output; } return $output; } } endif; if ( ! class_exists( 'Business_Club_Services_Widget' ) ) : /** * Service Widget Class * * @since 1.0.0 */ class Business_Club_Services_Widget extends WP_Widget { function __construct() { $opts = array( 'classname' => 'business_club_widget_services', 'description' => __( 'Show your services with icon and read more link.', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-services', __( 'Business Club: Services', 'business-club' ), $opts ); } function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 20; $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : __( 'Read more', 'business-club' ); $disable_excerpt = ! empty( $instance['disable_excerpt'] ) ? $instance['disable_excerpt'] : false ; $disable_more_text = ! empty( $instance['disable_more_text'] ) ? $instance['disable_more_text'] : false ; $block_page_1 = ! empty( $instance['block_page_1'] ) ? $instance['block_page_1'] : ''; $block_icon_1 = ! empty( $instance['block_icon_1'] ) ? $instance['block_icon_1'] : 'fa-cogs'; $block_page_2 = ! empty( $instance['block_page_2'] ) ? $instance['block_page_2'] : ''; $block_icon_2 = ! empty( $instance['block_icon_2'] ) ? $instance['block_icon_2'] : 'fa-cogs'; $block_page_3 = ! empty( $instance['block_page_3'] ) ? $instance['block_page_3'] : ''; $block_icon_3 = ! empty( $instance['block_icon_3'] ) ? $instance['block_icon_3'] : 'fa-cogs'; $block_page_4 = ! empty( $instance['block_page_4'] ) ? $instance['block_page_4'] : ''; $block_icon_4 = ! empty( $instance['block_icon_4'] ) ? $instance['block_icon_4'] : 'fa-cogs'; echo $args['before_widget']; // Title. if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } // Arrange data. $service_arr = array(); for ( $i = 0; $i < 4 ; $i++ ) { $block = ( $i + 1 ); $service_arr[ $i ] = array( 'page' => ${'block_page_' . $block}, 'icon' => ${'block_icon_' . $block}, ); } // Clean up data. $refined_arr = array(); foreach ( $service_arr as $key => $item ) { if ( ! empty( $item['page'] ) && get_post( $item['page'] ) ) { $refined_arr[] = $item; } } // Render content if ( ! empty( $refined_arr ) ) { $extra_args = array( 'excerpt_length' => $excerpt_length, 'more_text' => $more_text, 'disable_excerpt' => $disable_excerpt, 'disable_more_text' => $disable_more_text, ); $this->render_widget_content( $refined_arr, $extra_args ); } echo $args['after_widget']; } function render_widget_content( $service_arr, $args = array() ) { $service_column = count( $service_arr ); ?>
$service ) : ?>
'', 'block_page_1' => '', 'block_icon_1' => 'fa-cogs', 'block_page_2' => '', 'block_icon_2' => 'fa-cogs', 'block_page_3' => '', 'block_icon_3' => 'fa-cogs', 'block_page_4' => '', 'block_icon_4' => 'fa-cogs', 'excerpt_length' => 20, 'more_text' => __( 'Read more', 'business-club' ), 'disable_excerpt' => 0, 'disable_more_text' => 0, ) ); $title = esc_attr( $instance['title'] ); $block_page_1 = esc_html( $instance['block_page_1'] ); $block_icon_1 = esc_attr( $instance['block_icon_1'] ); $block_page_2 = esc_html( $instance['block_page_2'] ); $block_icon_2 = esc_attr( $instance['block_icon_2'] ); $block_page_3 = esc_html( $instance['block_page_3'] ); $block_icon_3 = esc_attr( $instance['block_icon_3'] ); $block_page_4 = esc_html( $instance['block_page_4'] ); $block_icon_4 = esc_attr( $instance['block_icon_4'] ); $excerpt_length = absint( $instance['excerpt_length'] ); $more_text = esc_attr( $instance['more_text'] ); $disable_excerpt = esc_attr( $instance['disable_excerpt'] ); $disable_more_text = esc_attr( $instance['disable_more_text'] ); ?>

 

/> 

/> 


$this->get_field_id( 'block_page_1' ), 'name' => $this->get_field_name( 'block_page_1' ), 'selected' => $block_page_1, 'show_option_none' => __( '— Select —', 'business-club' ), ) ); ?>

  

$this->get_field_id( 'block_page_2' ), 'name' => $this->get_field_name( 'block_page_2' ), 'selected' => $block_page_2, 'show_option_none' => __( '— Select —', 'business-club' ), ) ); ?>

  

$this->get_field_id( 'block_page_3' ), 'name' => $this->get_field_name( 'block_page_3' ), 'selected' => $block_page_3, 'show_option_none' => __( '— Select —', 'business-club' ), ) ); ?>

  

$this->get_field_id( 'block_page_4' ), 'name' => $this->get_field_name( 'block_page_4' ), 'selected' => $block_page_4, 'show_option_none' => __( '— Select —', 'business-club' ), ) ); ?>

  

'business_club_widget_teams', 'description' => __( 'Teams widget', 'business-club' ), 'customize_selective_refresh' => true, ); parent::__construct( 'business-club-teams', esc_html__( 'Business Club: Teams', 'business-club' ), $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 ); $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; $teams_column = ! empty( $instance['teams_column'] ) ? $instance['teams_column'] : 4 ; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 20; $number_of_teams = ! empty( $instance['number_of_teams'] ) ? $instance['number_of_teams'] : 4; echo $args['before_widget']; // Title. if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } ?> true, 'meta_key' => '_thumbnail_id', 'posts_per_page' => esc_attr( $number_of_teams ), ); if ( absint( $post_category ) > 0 ) { $qargs['category'] = absint( $post_category ); } $all_posts = get_posts( $qargs ); ?>
$post ) : ?>
'', 'post_category' => '', 'teams_column' => 4, 'excerpt_length' => 20, 'number_of_teams' => 4, ) ); $title = esc_attr( $instance['title'] ); $post_category = absint( $instance['post_category'] ); $excerpt_length = absint( $instance['excerpt_length'] ); $teams_column = esc_attr( $instance['teams_column'] ); $number_of_teams = esc_attr( $instance['number_of_teams'] ); ?>

'name', 'hide_empty' => 0, 'taxonomy' => 'category', 'name' => $this->get_field_name( 'post_category' ), 'id' => $this->get_field_id( 'post_category' ), 'selected' => $post_category, 'show_option_all' => __( 'All Categories','business-club' ), ); wp_dropdown_categories( $cat_args ); ?>