Pagination diplays always 2 pages
Pagination diplays always 2 pages
Pagination diplays always 2 pages
If your are using a custom template I assume you are using a custom loop so first populate $paged. <?php $max_posts = get_option(‘posts_per_page ‘); ?> <?php global $paged; ?> <?php if ( get_query_var(‘paged’) ) { $paged = get_query_var(‘paged’); } elseif ( get_query_var(‘page’) ) { $paged = get_query_var(‘page’); } else { $paged = 1; } ?> … Read more
Completely mess, but this solved my issue <?php function be_custom_loop() { $category = get_category(get_query_var(‘cat’)); $cat_id = $category->cat_ID; $cat_name = $category->name; echo ‘<div class=”home_title”>’ . $cat_name . ‘</div>’; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array( ‘cat’ => $cat_id, ‘paged’ => $paged ); query_posts($args); // The Loop while (have_posts()) : the_post(); $post_thumb = str_replace(home_url(), … Read more
This function uses get_the_posts_pagination() which uses the GLOBAL $wp_query to setup the paginate_links() function, so I believe that doesn’t work for get_posts. Try use the function paginate_links() by itself or the function posts_nav_link()
Use https://codex.wordpress.org/Pagination#static_front_page And https://codex.wordpress.org/Creating_a_Static_Front_Page Other solutions https://stackoverflow.com/questions/20644991/wordpress-static-page-pagination the query is diferent on static front pages … one hack after of your while <?php if ($the_query->max_num_pages > 1) : // custom pagination ?> <?php $orig_query = $wp_query; // fix for pagination to work $wp_query = $the_query; echo ‘<div class=”both”></div>’; understrap_pagination(); //your pagination $wp_query = $orig_query; // … Read more
The Base is the Problem: ‘base’ => add_query_arg(‘listpostspage’,’%#%’), Here ist the full code: $pagination_args = array( ‘base’ => add_query_arg(‘listpostspage’,’%#%’), ‘format’ => ‘?listpostspage=%#%’, ‘total’ => $the_query->max_num_pages, ‘current’ => $paged, ‘show_all’ => false, ‘end_size’ => 1, ‘mid_size’ => 2, ‘prev_next’ => true, ‘prev_text’ => __( ‘Zurück’, ‘Theme’ ), ‘next_text’ => __( ‘Weiter’, ‘Theme’ ), ‘type’ => ‘plain’, … Read more
How about using the built-in function? <?php previous_post_link( ‘%link’, ” . _x( ‘←’, ‘Previous post link’, ‘twentyten’ ) . ‘ %title’ ); next_post_link( ‘%link’, ‘%title ‘ . _x( ‘→’, ‘Next post link’, ‘twentyten’ ) . ” ); ?> More information on pagination is available here: Pagination the_posts_pagination
Turns out this line of code I had right above the rest to exclude a specific category from the homepage loop is what caused the issue: <?php if (is_home()) { WP_Query(“cat=-4”) ;} ?>
You did enter total number of posts/events as total page count. you should have passed total number of pages instead of total pages as “total” args. So to pass as total pages, you should calculate like TOTAL_POSTS/PER_PAGE.. so if you have 6 posts and you have 2 posts per page then it would be 6/2=3 … Read more
I was able to reproduce the error. Here’s what I think is happening. ‘number’ defines the number of users per page, and ‘paged’ tell the query which page to return. For example: $args = array(‘number’ => 2, ‘paged’ => 2) will return the second page at 2 per page. If you don’t have a query … Read more