Trouble with pagination
-
Hey guys,
I’m having massive trouble getting pagination to work in my Thematic child theme. It kinda works… partly, but not as desired. On my site I’m calling a custom loop:
<?php if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } $my_query = new WP_Query('cat=33&paged='.$paged); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
I didn’t include the whole loop when I call CSS code and the like to reduce confusion…
I also added a function in my functions.php. It’s where I tell WP to include a pagination in my childtheme:
<?php function absolutip_custom_pagination() { if(is_front_page() || is_page('blog') ) { ?> <div class="pagination"> <?php posts_nav_link(); ?> <?php global $my_query; $big = 999999999; echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'total' => $my_query->max_num_pages, 'prev_next' => $my_query->True, 'prev_text' => __( $big, '? Previous'), 'next_text' => __( $big, 'Next ?') ) ) ?> <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <?php endwhile; endif; ?> </div> <?php } } add_action( 'thematic_belowcontent', 'absolutip_custom_pagination' ); ?>
Somehow pagination never shows the << Previous Next >> link. It does show up however, if I add
'current' => 1,
to my absolutip_custom_pagination function. However, then Page 1 can’t be clicked anymore…Can anyone help me, and could it be that my pagination doesn’t know what page it’s on?
Thanks so much
[Moderator Note: No bumping, thank you.]
- The topic ‘Trouble with pagination’ is closed to new replies.