Bonesnap / sneakyimp
Thanks for so quick and so detailed reply!
Yes, the page has the right headers and other info, but posts are missing.
Today all day I have been trying to sort this issue by changing and trying all things that you mentioned to me in your posts, but could not fix it. Also I checked out the WordPress Codex on pagination. Thanks Bonesnap, and I think now I know what causing this problem.
When multiple loops (posts lists) are used in a theme template file only one loop, the main loop, can be paginated.
I have two instances of the Loop: The first is limited to one post.
<?php if(1 == $paged) { //check if is page one and display main headlines and subcategories?>
<?php //get category headline
$cat = get_query_var('cat');
$category_headline = ae_get_category_headline($cat);
if ($category_headline) { ?>
<div class="category-headline">
<?php foreach($category_headline as $post) : setup_postdata($post); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<h3><?php the_title(); ?></h3></a>
<?php the_content('Read more...'); ?>
<ul class="inline-list main-headline-social">
<li><?php comments_popup_link('Leave a Comment', 'View Comments (1)', 'View Comments (%)'); ?></li>
<li class="addthis_toolbox addthis_pill_combo_style"><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_facebook_like"></a><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_tweet"></a><a addthis:url="<?php the_permalink(); ?>" class="addthis_button_compact"></a></li>
</ul>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
</div>
<?php } ?>
The second has 50 post limit but has an offset of 1 (since the first post was displayed in the first loop).
<div class="all-category-posts">
<h4 class="title">All news in <?php echo single_cat_title( '', false );?></h4>
<?php
$args = array(
'posts_per_page' => 50,
'post_type' => 'post',
'cat' => $cat,
'offset' => 1,
'orderby' => 'post_date',
'order' => 'desc',
'post_status' => 'publish',
'suppress_filters' => true,
'paged' => $paged,
);
$allposts = get_posts($args);
foreach ($allposts as $post) : setup_postdata($post); ?>
<article>
<header>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(array(80,80), array('class' => 'alignleft')); ?></a>
<p class="date"><?php the_time(get_option('date_format')); ?></p>
<hr class="rule" />
<a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
</header>
<?php the_excerpt(); ?>
</article>
<?php endforeach; ?>
</div>
I display the first post, so it stands out and has focus, then insert a featured content, and finally display the other posts. The number of posts it displays in the second loop doesn't matter, just as long as it is offset by 1.
Just for test I have swapped this two loops around and posts start paginating, but pagination showing the same results (from page 1) for each page.
Now I need to find solution how to paginate secondary loop or create one loop where I can keep everything in one loop.
Also I am not sure why it keep showing the same result for each page?