Given a blog featuring several categories (such as "Sport", "Nature", etc), I've then proceded to create a custom taxonomy, which allows me to show articles in certain areas of my blog with terms such as "slideshow", "sidebar-highlight", "top-category", etc.
Inside my sidebar, I've created an area where articles (from the same category, lets say "Nature") are shown using two different loops. The first one shows only one article (the first one in chronological order, from the nature category and which is also inside the "sidebar-highlight" taxonomy's term) with a featured image, title and excerpt, whilst the second, only shows the latest 3 articles from the Nature category. In order to avoid duplicates, I've been using the following code:
$nature_loop_1 = new WP_Query( array (
'category_name' => 'nature',
'tax_query' => array (
array (
'taxonomy' => 'highlight',
'field' => 'slug',
'terms' => 'sidebar-highlight',
'operator' => 'IN'
)
),
)
);
$nature_loop_2 = new WP_Query( array (
'category_name' => 'nature',
'tax_query' => array (
array (
'taxonomy' => 'highlight',
'field' => 'slug',
'terms' => 'sidebar-highlight',
'operator' => 'NOT IN'
)
),
)
);
Yet, while this works, this means articles from "sidebar-highlight" will never show inside the second loop, no matter when they were posted. So I was wondering if is there any way I could manage to avoiding duplicates while allowing articles from "sidebar-highlight" term show.
Thanks in advance.