'bizroot_widget_social', 'description' => esc_html__( 'Social Icons Widget', 'bizroot' ), ); parent::__construct( 'bizroot-social', esc_html__( 'Bizroot: Social', 'bizroot' ), $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 '
'bizroot_widget_latest_news', 'description' => __( 'Latest News Widget. Displays latest posts in grid. Most suitable for home page.', 'bizroot' ) ); parent::__construct( 'bizroot-latest-news', esc_html__( 'Bizroot Latest News Widget', 'bizroot' ), $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'; $post_number = ! empty( $instance['post_number'] ) ? $instance['post_number'] : 4; $excerpt_length = ! empty( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 40; $more_text = ! empty( $instance['more_text'] ) ? $instance['more_text'] : __( 'Read more','bizroot' ); $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_number ), 'no_found_rows' => true, ); if ( absint( $post_category ) > 0 ) { $qargs['category'] = absint( $post_category ); } $all_posts = get_posts( $qargs ); ?> '', 'post_category' => '', 'post_column' => 4, 'featured_image' => 'medium', 'post_number' => 4, 'excerpt_length' => 40, 'more_text' => __( 'Read more', 'bizroot' ), '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'] ); $post_number = absint( $instance['post_number'] ); $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','bizroot' ), ); 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( '1' => 1, '2' => 2, '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 = bizroot_get_image_sizes_options(); if ( ! empty( $choices ) ) { $output = "\n"; } if ( $r['echo'] ) { echo $output; } return $output; } } endif;