Here is my full page code ,i can't fix this , anyone please help . <?php /* Template Name: Gallery */ ?> <?php get_header(); ?> <center><?php include('adsup.php'); ?></center> <div class="mainw"><div class="main l170"> <h1><?php _e('Recently Added Free indian Photos', 'mytheme'); ?></span></h1> <?php query_posts(array('posts_per_page' => 21, 'post_type' => 'gallery', 'order' => 'DESC', 'ignore_sticky_posts' => 'true', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), )); ?> <?php if ( have_posts() ) : ?> <ul class="listThumbs"> <?php if (get_option('mtn_adsindex') <> '') { ?> <li class="adsRight"> <?php echo stripslashes(get_option('mtn_adsindex')); ?> </li> <?php } else { ?> <?php } ?> <?php while ( have_posts() ) : the_post(); ?> <li class="thumi"> <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"> <img src="<?php echo get_post_meta($post->ID, 'thumb', true); ?>" alt="<?php the_title_attribute(); ?>" style=" height:235px;> </a> <span class="scrub"><span></span></span></a> <a href="<?php the_permalink(); ?>" class="title" rel="bookmark"><?php if (strlen($post->post_title) > 40) { echo substr(the_title($before = '', $after = '', FALSE), 0, 45) . '...'; } else { the_title(); } ?></a> <span class="added"> <?php if(function_exists('the_views')) { the_views(); } ?> views </span><span class="rating"><?php echo time_ago(); ?></span> </li> <?php endwhile; wp_reset_query(); ?> </ul> <?php else : ?> <p><?php _e('No Photos Found', 'mytheme'); ?></p> <?php endif; ?> <div class="navigation"><?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?></div> </div> </div> <?php include (TEMPLATEPATH . '/galleryside.php'); ?> <center> <?php include('adsfoot.php'); ?> <p> <div class="foot2"> <?php get_search_form(); ?> </div> <p> <div class="foot2"> <?php include('footads.php'); ?> </div> </center> <?php get_footer(); ?> PHP:
I am not sure, but this may work for you... just an idea if( $attribute['pagination']==true){ $pagination_n .='<div class="col-md-12">'; /* * Remember to set our maximum pages for the custom query*/if( function_exists('n_pagination')){ $pagination_n .=n_pagination( $q->max_num_pages ); }else{ $pagination_n .= get_next_posts_link('«« Older Posts', $q->max_num_pages ); $pagination_n .= get_previous_posts_link('Newer Posts »»'); } $pagination_n .='</div>';
I think it works out try to use a custom pagination plugin like https://wordpress.org/plugins/wp-paginate/