'widget-blackvideo-home-block-one', 'description' => __( 'Display post content blocks. Only use for the "Home Content" widget area.', 'blackvideo' ) ); // Create the widget. parent::__construct( 'blackvideo-home-block-one', // $this->id_base __( '» Home Content', 'blackvideo' ), // $this->name $widget_options // $this->widget_options ); } /** * Outputs the widget based on the arguments input through the widget controls. * * @since 1.0.0 */ function widget( $args, $instance ) { // Default value. $defaults = array( 'title' => '', 'limit' => 4, 'cat' => '', 'col' => '4col' ); $instance = wp_parse_args( (array) $instance, $defaults ); extract( $args ); // Output the theme's $before_widget wrapper. echo wp_kses_post( $before_widget ); // Theme prefix $prefix = 'blackvideo-'; // Pull the selected category. $cat_id = isset( $instance['cat'] ) ? absint( $instance['cat'] ) : 0; // Get the category. $category = get_category( $cat_id ); // Get the category archive link. $cat_link = get_category_link( $cat_id ); // Posts query arguments. $args = array( 'post_type' => 'post', 'posts_per_page' => ( ! empty( $instance['limit'] ) ) ? absint( $instance['limit'] ) : 6 ); // Limit to category based on user selected tag. if ( ! $cat_id == 0 ) { $args['cat'] = $cat_id; } // Allow dev to filter the post arguments. $query = apply_filters( 'blackvideo_home_one_column_args', $args ); // The post query. $posts = new WP_Query( $query ); $i = 1; $col = isset( $instance['col'] ) ? strip_tags( $instance['col'] ) : '4col'; $grid_col = 'ht_grid_1_4'; if ($col == '4col') { $grid_col = 'ht_grid_1_4'; } else { $grid_col = 'ht_grid_1_3'; } if ( $posts->have_posts() ) : ?>