Hi,
I have an issue with homepage and pagination. I am trying to to not duplicate a post using 2 different queries. I have a special layout to highlight the last video post and after a loop with all posts from the blog.
I succeeded in not showing twice the highlighted post with information from : http://wordpress.org/support/topic/do-not-duplicate-post-covering-2-queries/page/2?replies=35
But I have a pagination and now, the last post from page 1 is appearing also in first place of page 2.
First loop
<?php global $do_not_duplicate; //NEW DECLARATION in the header part of the code ?>
<?php $do_not_duplicate = array();
$my_query = new WP_Query(array(
'posts_per_page' => 1,
'order' => 'DESC',
'orderby' => 'date',
'meta_key' => THEME_NAME.'_main_slider',
'meta_value' => 'yes',
'post_type' => 'post',
'ignore_sticky_posts ' => 1,
'post_status ' => 'publish'
) );
?>
<?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID;
?>
Second loop
<?php
function homepage_news_block_5($blockType, $blockId,$blockInputType) {
global $blogStyle;
global $do_not_duplicate;
$cat = get_option(THEME_NAME."_".$blockType."_cat_".$blockId);
$count = get_option(THEME_NAME."_".$blockType."_count_".$blockId);
$pagination = get_option(THEME_NAME."_".$blockType."_pagination_".$blockId);
$blogStyle = get_option(THEME_NAME."_".$blockType."_blog_style_".$blockId);
$paged = get_query_string_paged();
$args = array(
'post_type' => "post",
'cat' => $cat,
'paged'=>$paged,
'posts_per_page' => $count,
'post__not_in' => $do_not_duplicate
);
$my_query = new WP_Query($args);
$counter = 1;
?>
I didn't find an answer on forums so far, someone could help me, please ?
Thank you for your time