<ul class="m-grid cf"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array('post_type' => 'portfolio','posts_per_page'=> 9, 'order' => 'DESC', 'paged' => $paged ); query_posts( $args ); if ( have_posts() ) : while ( have_posts() ) : the_post();?> <li class="mod-third"><a href="<?php the_permalink();?>"> <figure class="face thumb"> <?php if ( has_post_thumbnail() ) { the_post_thumbnail('portfolio-thumb'); } ?> </figure> <h3 class="back"><?php the_title();?></h3> </a></li> <?php endwhile; //Pagination if(function_exists('my_paginate_links')) { my_paginate_links(); } endif; wp_reset_postdata(); wp_reset_query(); ?> </ul>
function my_paginate_links() { global $wp_rewrite, $wp_query; $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; $pagination = array( 'base' => @add_query_arg('page','%#%'), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'prev_text' => __('« Previous page'), 'next_text' => __('Next page »'), 'end_size' => 1, 'mid_size' => 2, 'show_all' => true, 'type' => 'list' ); if ( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ); if ( !empty( $wp_query->query_vars['s'] ) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) ); echo paginate_links( $pagination ); }
& here is the pagination function
So what's wrong & how can I fix this?
Thanks.
Unfortunately I can't show the site.