Check if on last page of paginated post using wp_link_pages
You can find this info in the global vars $multipage, $numpages, and $page global $multipage, $numpages, $page; if( $multipage && $page == $numpages ) echo ‘last page’;
You can find this info in the global vars $multipage, $numpages, and $page global $multipage, $numpages, $page; if( $multipage && $page == $numpages ) echo ‘last page’;
The paginate_links() function, located in wp-includes/general-template.php, doesn’t allow for certain parts of the HTML (such as the page-numbers class) to be customized. A simple string replacement will not work due to the way that the classes are generated, as highlighted in this excerpt of code from paginate_links(): $page_links[] = ‘<a class=”prev page-numbers” href=”‘ . esc_url( … Read more
The paginate_links() function does this by default. The controlling parameter is mid_size, which determines the number of page links around the current page to display. The default value is 2. What this means is that, assuming you have 12 pages, and the current page is Page 1, the pagination will look like: 1 2 3 … Read more
Just build a link that has some query args: printf( ‘<a href=”http://example.com/all-comments?pid=%s”>All comments</a>’ ,get_the_ID() ); Then add a page with a a permalink of all-comments, so you have something to target. There you attach a template like the following (just a base to work off): <?php /** * Template Name: All Comments */ // Abort … Read more
Yes, it is possible, and I use it on my own site. Here it is in action: my Settings API post is paginated, but can viewed on a single page, using the “Single-Page View” link. First, you need to prepare a custom query variable, e.g. in functions.php, add the following: function cbnet_parameter_queryvars( $qvars ) { … Read more
Take a look at this tutorial: http://www.wpmods.com/easily-ajax-wordpress-pagination
previous_post_link takes 5 params, but you use only 2 of them. Let’s take a look at other 3: in_same_term (boolean) (optional) Indicates whether previous post must be within the same taxonomy term as the current post. If set to ‘true’, only posts from the current taxonomy term will be displayed. If the post is in … Read more
Looking at the source of paginate_links() it seems there is no option available to always include a previous or next link. The function simply compares the current page number with the total page number to determine whether these links need to be added. Working around this problem is possible, though. This should get you started: … Read more
The goal was to paginate comments, showing comments with the highest comment_rating meta value first. Thanks to the answer of cjbj and the comments by Milo and birgire I figured out the rather unintuitive solution to the issue. By using numberand offset I was able to make the results in the proper order, but pagination … Read more
Short answer: Try ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => ‘?paged=%#%’, Long answer: I took a look at the paginate_links() source code (v3.5.1) and there is this line (#) $link = str_replace(‘%_%’, 1 == $n ? ” : $format, $base); that is giving you the empty first page link. … Read more