'recent_posts', 'description' => 'Displays the post image and title.'.'bundler' ); /* Create the widget. */ parent::__construct( 'recent_posts-widget','Bundler - Premium Recent Posts', $widget_ops, '' ); } function widget( $args, $instance ) { global $bundler_data; extract( $args ); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title'] ); // to sure the number of posts displayed isn't negative or more than 10 if ( !$number = (int) $instance['number'] ) $number = 5; else if ( $number < 1 ) $number = 1; else if ( $number > 10 ) $number = 10; //the query that will get post from a specific category. //Wr slug the category because you actualy need the slug and not the name $pc = new WP_Query(array('orderby'=>'date','post_type' => 'post' , 'showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'ignore_sticky_posts' => 1 ,'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-link'), 'operator' => 'NOT IN' ) ))); //display the posts title as a link if ($pc->have_posts()) : echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; ?> have_posts()) : $pc->the_post(); ?>
'Recent Posts', 'number' => 5); $instance = wp_parse_args( (array) $instance, $defaults ); ?>
(at most 10)