Can't get pagination links to work
-
Hi everyone!
I’m building a blog and it almost works the way I want (so that’s great). The only thing that doesn’t work is the pagination section. I would like it to look like this:
? Prev 1 … 3 4 5 6 7 … 9 Next ?
(Anything close would do fine.)
But how?
This is what I got thus far.
<?php // WP_Query arguments $args = array ( 'post_status' => 'publish', 'pagination' => true, 'posts_per_page' => '5', 'order' => 'DESC', 'orderby' => 'date', 'paged' => $paged, 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'before_page_number' => '<span>Page </span>' ); // The Query $query = new WP_Query( $args ); $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1; $big = 999999999; // need an unlikely integer // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); $cats = ''; foreach( get_the_category( $recent["ID"] ) as $cat ) { $cats .= ' ' . $cat->slug; } echo '<header><h4>' . get_the_title() . '</h4><p>'. get_the_date() . ' - <span class="icon ' . $cats .'"></span></p></header><p>'. get_the_content() . '</p>'; } } else { echo paginate_links(); } // Restore original Post Data wp_reset_postdata(); ?>
I am not very familiar with php, so I hope anyone of you can find a few minutes to help me out here.
Thanks very much in advance!
Meindert
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Can't get pagination links to work’ is closed to new replies.