-1, 'title' => esc_html__('Our Latest News','business-trade'), 'meta_options' => 0, 'post_number' => 3, ); return $defaults; } public function __construct() { parent::__construct( /* Widget Unique ID */ 'business-trade-recent-post-widget', /* Widget Name */ esc_html__( 'TM: Blog Widget', 'business-trade' ), /* Widget description */ array( 'description' => esc_html__( 'TM: Our Blog Widget Best Used in Home page', 'business-trade' ) ) ); } /** * Function to Creating widget front-end. This is where the action happens * * @access public * @since 1.0 * * @param array $args widget setting * @param array $instance saved values * * @return void * */ public function widget( $args, $instance ) { if ( !empty( $instance ) ) { $instance = wp_parse_args( (array ) $instance, $this->defaults() ); echo $args['before_widget']; $catid = absint( $instance['cat_id'] ); $title = apply_filters('widget_title', !empty($instance['title']) ? esc_html( $instance['title']): '', $instance, $this->id_base); $meta_options = esc_attr( $instance['meta_options'] ); $post_number = absint( $instance['post_number'] ); ?>
esc_html__('From Blog Posts', 'business-trade'),
'orderby' => 'name',
'order' => 'asc',
'show_count' => 1,
'hide_empty' => 1,
'echo' => 1,
'selected' => $catid,
'hierarchical' => 1,
'name' => esc_attr( $this->get_field_name('cat_id') ),
'id' => esc_attr( $this->get_field_name('cat_id') ),
'class' => 'widefat',
'taxonomy' => 'category',
'hide_if_empty' => false,
);
wp_dropdown_categories( $business_trade_con_dropown_cat );
?>
/>