Add next and previous post links on pages like category, tags or archive pages
I am trying to find a solution for getting next pages for category or tag page in WordPress, tried with next_posts_link
and previous_posts_link
in these pages, but it's not working.
Same functions are working on post listing page for me
Below is my code
div class="wrapper inner_content_wrap"
?php next_posts_link( 'span class="label iconfont"img src="'.get_template_directory_uri().'/images/pager_arw.png" alt=""/spanspan class="entry-info-wrap"Next Entries/span',3); ?
?php previous_posts_link( 'span class="label iconfont"img src="'.get_template_directory_uri().'/images/pager_arw2.png" alt=""/spanspan class="entry-info-wrap"previous Entries/span'); ?
div class="blog_area"
div class="container"
?php
if(have_posts()) :
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array( 'post_type' = 'post', 'posts_per_page' = 3, 'paged' = $paged );
$loop = new WP_Query( $args );
$i = '1';
while ( $loop-have_posts() ) : $loop-the_post(); ?
?php if($i=='1' || $i%3 =='1') { echo 'div class="blog_post first"';} else { echo 'div class="blog_post"';} ?
div class="date"?php the_time('M'); ?strong?php the_time('j'); ?/strong/div
div class="imgbox" ?php $url = get_the_post_thumbnail($post_id, 'blog_thumb');
echo $url; ?/div
div class="content"
h5a href="?php the_permalink(); ?"?php the_title(); ?/a/h5
p?php the_excerpt(); ?a href="?php the_permalink(); ?"[...]/a/p
div class="bottom_box"
?php $categories = get_the_category();
foreach($categories as $category) {
echo 'a href="'.get_category_link( $category-term_id ).'" class="button" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category-name ) ) . '"'.$category-cat_name.'/a';
}?
div class="clear"!-- --/div
/div
/div
/div
?php
$i++;
endwhile;
else:
get_template_part( 'content', 'none' );
endif;
wp_reset_postdata();
?
div class="clear"!-- --/div
/div
/div
/div
Topic next pagination links Wordpress
Category Web