__('Primary', 'bootstrap-x'), 'id' => 'sidebar-primary', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Widgets register_widget('bootstrapx_recent_posts_widget'); } add_action('widgets_init', 'bootstrapx_widgets_init'); /** * bootstrapx recent post widget */ class bootstrapx_recent_posts_widget extends WP_Widget { public function __construct() { parent::__construct( 'bootstrapx-recent-posts', // Base widget ID __('01 : Recent Posts Widget', 'bootstrap-x'), // Title of Widget array( 'description' => __( 'Show list of recent posts with whumbnail anywhere in widget area.', 'bootstrap-x' ), ) ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $no_of_posts = apply_filters( 'no_of_posts', $instance['no_of_posts'] ); echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; // WP_Query arguments $query_args = array ( 'post_type' => 'post', 'posts_per_page' => $no_of_posts, 'offset' => 0, 'ignore_sticky_posts' => 1 ); // The Query $bootstrapx_recent_posts = new WP_Query( $query_args ); if($bootstrapx_recent_posts->have_posts()) : ?> have_posts()) : $bootstrapx_recent_posts->the_post(); ?>

...Read More' ); echo $widget_excerpt; // echo the trimmed content upto 10 words. ?>
Sorry ! There are no posts yet.