Remove duplicated posts from Widget
-
Hello,
My WP theme includes 2 top sections that each one shows the latest 2 posts. Below these 2 sections there are sections of categories I choose. Each category section is basically a widget (theme-built-in widget) contains the last posts from each category.
:
In order to remove duplicate posts from the 2 top categories I got the following code:if ( $newscard_settings['newscard_banner_featured_posts_1_hide'] === 0 ) { $featured_post_1_ids = wp_list_pluck( $newscard_get_featured_post_1->posts, 'ID' ); $post_type_fp_2['post__not_in'] = array_unique( array_merge( $post_type_fp_2['post__not_in'], $featured_post_1_ids ) ); }
What is the code that will make sure the categories section doesn’t contain posts that are in the 2 top sections?
The widget code attached in the first comment
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Remove duplicated posts from Widget’ is closed to new replies.