Hello guys,
So I have just developed a brand new theme, and I added a Blog template page, which shows posts from a category I choose from my custom admin panel.
I am crrently using a 'Blog' page which is set with the blog template ad my front page. But I'm having quite of a problem with the pagination. The first page is completely fine, it'll show the latest posts from that certain category, but when I click on the second page or whichever other than the first, it'll show all the other posts (but not the blog posts).
I have also noticed that the active page is not the blog page anymore once I click on the the pagination link. Anyway, below there's my code
<?php
if((get_option('np_blog_active') == "Active")) {
$temp = $wp_query;
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('showposts=' . $limit . '&paged=' . $paged . '&cat='. get_cat_ID(get_option('np_blog_cat')));
}
if(have_posts()) : while(have_posts()) : the_post();
$meta = get_post_meta( $post->ID, 'DDPortfolio', true );
?>
HERE GOES THE LOOOOOP
<?php endwhile; endif; ?>
<ul class="pagination">
<?php
include(TEMPLATEPATH . '/functions/pagination.php');
if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
?>
</ul>
Any idea WHY this is happening?
By the way this is how the pagination output is:
<ul class="pagination">
<li class="current"><a href="#">1</a></li>
<li><a href="http://localhost/newPortfolio/?paged=2" class="page" title="2">2</a></li>
<li><a href="http://localhost/newPortfolio/?paged=3" class="page" title="3">3</a></li>
<li><a href="http://localhost/newPortfolio/?paged=4" class="page" title="4">4</a></li>
</ul>
Thank you.