Reverse ordered pagination on home page

The default order of posts is date descending. To reverse it for home page you could hook into pre_get_posts and for is_home() query set order parameter to ASC. Note that that pages would still go from 1 ascending, they will just have posts on them in opposite order. I don’t think actually reversing order of … Read more

How to devide post into more than one page using ?

The function you’re looking for is wp_link_pages(). Default usage below: wp_link_pages( array( ‘before’ => ‘<p>’ . __(‘Pages:’), ‘after’ => ‘</p>’, ‘link_before’ => ”, ‘link_after’ => ”, ‘next_or_number’ => ‘number’, ‘nextpagelink’ => __(‘Next page’), ‘previouspagelink’ => __(‘Previous page’), ‘pagelink’ => ‘%’, ‘echo’ => 1 ) ) You can read the documentation here: http://codex.wordpress.org/Function_Reference/wp_link_pages

pagenavi shows a lot of pages calculated from all posts in the site with query_posts

I didn’t load the plugin to check and I never use query_posts(), but perhaps tie_pagenavi() is depending on the value in the $paged global variable. Try adjusting that value before (or after) calling query_posts(). Here is the code to adjust it before calling query_posts(). if ( get_query_var( ‘paged’ ) ) // On a paged page. … Read more

Stop loading more posts if none left AJAX

Yes use wp_query 🙂 Anyway, to prevent loading posts while you’re out of pages, you need to know the current page number last loaded and the total number of pages that exist. Total pages that exist: $max = $wp_query->max_num_pages; Current page: just count it in your load loop, so set the var to 1, then … Read more

How to group posts by months and add pagination?

Try this code <?php $catnam = ‘1’; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; // the total of registers to show on each page $showp = 4; wp_get_archives(“type=monthly&showposts=$showp&paged=$paged”); while (have_posts() ) : the_post();?> <h4><a href=”https://wordpress.stackexchange.com/questions/131770/<?php echo get_permalink(); ?>”><?php the_title();?></a></h4> <?php endwhile;?> <?php global $wp_rewrite; $paginate_base = get_pagenum_link(1); if (strpos($paginate_base, ‘?’) || ! $wp_rewrite->using_permalinks()) { $paginate_format=””; … Read more