'abedul_formats',
'description' => __('Use this widget to show one or more of your formatted posts','abedul'),
);
parent::__construct( 'abedul_formats', __('Abedul Formats', 'abedul'), $widget_ops );
}
/**
* Outputs the content of the widget
*
* @param array $args
* @param array $instance
*/
public function widget( $args, $instance ) {
// outputs the content of the widget
$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base );
// Puts the selected post formats in an array that can be used in the query.
$terms = array();
foreach ($this->formats as $key => $value) {
if (!empty($instance['formats'][$value])) {
$value = $instance['formats'][$value];
//echo $value; echo '
';
$terms[]= 'post-format-'.$value;
}
}
//echo '
'.print_r($terms,true).''; // Starts the query work. $is_sticky = get_option('sticky_posts'); $args_query = array( 'posts_per_page' => 30, 'post__not_in' => $is_sticky, 'ignore_sticky_posts' => 1, 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $terms, 'operator' => 'IN', ),),); $query = new WP_Query($args_query); //echo '
'.print_r($query,true).''; if ( $query->have_posts() ): echo $args['before_widget']; echo '
formats as $key => $slug ):?>
/>
'.print_r($instance,true).'';
//$fake_instance = $_POST['widget-'.$this->id_base][$this->number];
//echo '
'.print_r($fake_instance,true).''; ?>