Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
open-source
Guaraci WordPress Plugin
Commits
4931fb75
Commit
4931fb75
authored
5 years ago
by
Bruno Antunes Magrini
Browse files
Options
Download
Email Patches
Plain Diff
change query so it works with tax query and other options from posts-list
parent
2f21b9b9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
8 deletions
+3
-8
pagebuilder-components/widgets/most-read-posts-list/tpl/template.php
...-components/widgets/most-read-posts-list/tpl/template.php
+3
-8
No files found.
pagebuilder-components/widgets/most-read-posts-list/tpl/template.php
View file @
4931fb75
...
...
@@ -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
);
?>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment