Commit 4931fb75 authored by Bruno Antunes Magrini's avatar Bruno Antunes Magrini
Browse files

change query so it works with tax query and other options from posts-list

parent 2f21b9b9
......@@ -4,6 +4,7 @@ $show_images = $instance['show_images'];
$show_excerpt = $instance['show_excerpt'];
$hide_categories = $instance['hide_categories'];
$css_classes = $instance['css_class'];
$link = $instance['link'];
if (isset($instance['conteudo'])) {
parse_str($instance['conteudo'], $conteudo);
......@@ -11,18 +12,12 @@ if (isset($instance['conteudo'])) {
}
$i = 0;
// print_r($instance);
// print_r($conteudo);
// print_r($date);
$most_read = AjaxPageviews::get_top_viewed($conteudo['posts_per_page'], ['post_type' => $conteudo['post_type'], 'from' => $date->after]);
$most_read = AjaxPageviews::get_top_viewed(1000, ['post_type' => $conteudo['post_type'], 'from' => $date->after]);
$ids = array();
foreach ($most_read as $post => $value) {
array_push($ids, $value->post_id);
}
$query_args = array(
'post_type' => $conteudo['post_type'],
'post__in' => $ids
);
$query_args['post__in'] = $ids;
$query = new WP_Query($query_args);
?>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment