Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display posts hidden in Recent Stories list when "Avoid Duplicate Posts" is checked #1287

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions inc/widgets/largo-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ function widget( $args, $instance ) {
);

if ( isset( $instance['avoid_duplicates'] ) && $instance['avoid_duplicates'] === 1 ) {
// Create a temporary array and fill it with posts from $shown_ids and from the page's original query
$duplicates = (array) $shown_ids;
foreach( $wp_query->posts as $post ) {
$duplicates[] = $post->ID;
}
$query_args['post__not_in'] = $duplicates;
$query_args['post__not_in'] = $shown_ids;
}
if ( $instance['cat'] != '' ) $query_args['cat'] = $instance['cat'];
if ( $instance['tag'] != '') $query_args['tag'] = $instance['tag'];
Expand Down