Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I tried many of pagination functions but no one is working good. They all display page count and link to page but when I click on the link no result. Nothing is changed except browser's adress link. I guess I forgot some options to my query.

<?php 
$args = array(
'posts_per_page' => '10',
'post_type' => 'post',
'paged' => get_query_var('paged')
);
    query_posts($args);
?>

<?php while (have_posts()) : the_post(); 
        if ( has_post_thumbnail() ) :
        ....................
 ?>
  <?php endif; ?>

<?php endwhile; ?>
<?php if (function_exists("pagination")) 
{
    pagination('»', '«');
} ?>

I tried the same query with new WP_Query, but was no difference Pagination function is:

function pagination($prev = '«', $next = '»') {
global $wp_query, $wp_rewrite;
$wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;
$pagination = array(
    'base' => @add_query_arg('paged','%#%'),
    'format' => '',a
    'total' => $wp_query->max_num_pages,
    'current' => $current,
    'prev_text' => __($prev),
    'next_text' => __($next),
    'type' => 'plain'
);
    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 );
};

Any ideas what's wrong?

share|improve this question
1  
what type of page are you trying to do this on? –  Milo Apr 4 '13 at 15:47
    
@Milo usual php page-template –  okonik Apr 4 '13 at 16:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.