Normal post (not custom post type), I did everything I should do, but 404 not found error in pagination. Here is my code
$category_id = get_query_var('cat'); //Using this to get category ID to meet some special requirements
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'posts_per_page' => 4,
'numberposts' => 50,
'paged' => $paged,
'cat' => $category_id
);
query_posts($args);
if ( have_posts() ) : while ( have_posts() ) : the_post();
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' );
?>
<div id="post-item">
<div class="thumb"><img src="<?php echo get_stylesheet_directory_uri(); ?>/timthumb.php?src=<?php echo $image[0]; ?>&w=224&h=224&zc=1" /></div>
<div class="detail">
<h2 class="wrtitle"><span class="blue"><?php $category = get_the_category(); echo $category[0]->cat_name; ?> : </span><?php the_title(); ?></h2>
<div class="date"><?php the_date(); ?></div>
<div class="excerpt"><?php the_excerpt(); ?></div>
</div>
<div class="rmore"><a href="<?php the_permalink(); ?>"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/readmore.png" /></a></div>
</div>
<?php endwhile;
wp_reset_postdata();
else: ?>
<p><?php _e('No posts found'); ?></p>
<?php endif; ?>
<!-- Pagination Part -->
<div id="pagination">
<div class="next"><?php next_posts_link('next »') ?></div>
<div class="prev"><?php previous_posts_link('« previous') ?></div>
</div>
I need your suggestion.