WP 4 and Pagination
-
Pulling my hair out!!!!!
Ok so I am setting up Pagination on a loop, something that I have done a bunch of times… more than enough, this is a simple code base that I wrote using the codex and up until now it has worked EVERY time.
Now it is not!
Here is the loop
‘
global $my_query;$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
// Arguments for the custom WP_Query
$args = array(‘posts_per_page’ => ‘5’,
‘paged’ => $paged,
‘category_name’ => ”,
‘type’ => ‘my_query’,
‘child_of’ => 0,
‘parent’ => ”,
‘orderby’ => ”,
‘order’ => ‘ASC’,
‘hide_empty’ => 1,
‘hierarchical’ => 1,
‘exclude’ => ”,
‘include’ => ”,
‘number’ => ”,
‘taxonomy’ => ”,
‘pad_counts’ => false,);
$my_query = new WP_Query($args);
?>
<?php if ( $my_query->have_posts() ) : ?>
<!– the loop –>
<?php while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
‘
and now for my pagination‘
<div class=”pagination”><?php
$unliklyint = 999999999; // need an unlikely integerecho paginate_links( array(
‘base’ => str_replace( $unliklyint, ‘%#%’, esc_url( get_pagenum_link( $unliklyint ) ) ),
‘format’ => ‘/page/%#%’,
‘current’ => max( 1, get_query_var(‘paged’) ),
‘prev_next’ => false,
//’prev_text’ => __(‘? Previous’),
//’next_text’ => __(‘Next ?’),
‘end_size’ => ”,
‘mid_size’ => ”,
‘type’ => ”,
‘add_args’ => ”,
‘add_fragment’ => ”,
‘before_page_number’ => ”,
‘after_page_number’ => ”,
‘show_all’ => true,
‘total’ => $my_query->max_num_pages
) );
?></div>
‘Been at it for hours searching the web, then I tried a plugin and it did the same thing…
Is this a bug, was something depreciated, or am I missing something, hope to hear back soon, thanks for looking.
- The topic ‘WP 4 and Pagination’ is closed to new replies.