wp_link_pages appearing after post content and not at bottom of page

Your call of wp_link_pages displays navigation immediately because echo argument is set to 1 by default, and it means to echo result. So try to add &echo=0 at the ennd of wp_link_pages call: add_filter (‘the_content’, ‘pagination_after_post’,1); function pagination_after_post($content) { if(is_single()) { $content.= ‘<div class=”pagination”>’ . wp_link_pages(‘before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous&echo=0’) . ‘</div>’; } return $content; } Read more about … Read more

Remove Spaces From WP_LINK_PAGES

Just replace a> <a with a><a: echo str_replace( ‘a> <a’, ‘a><a’, wp_link_pages( array ( ‘echo’ => FALSE ) ) ); If you want to remove the spaces around unlinked numbers too, I suggest a separate function in your theme’s functions.php to keep the code readable: function trimmed_link_pages( $args = array () ) { $args[‘echo’] = … Read more

How to ignore wp_link_pages function?

wp_link_pages has two filters you can use: The wp_link_pages_args filter is passed the $args for wp_link_pages so you could set echo to false. The wp_link_pages filter is passed the output so you could set the output to nil. Something like this should work: /** * Filter the HTML output of page links for paginated posts. … Read more

Add Unique Classes to Next and Previous in WP_LINK_PAGES

First, I would add a string formatting placeholder to ‘link_before’, like so… $args[‘link_before’] = ‘<span class=”classlinks %s”>’; Next, I would use sprintf() to insert an appropriate class for the appropriate link (let’s assume the classes will be ‘link-before’ and ‘link-after’, respectively). Like so… if($page-1) // there is a previous page $args[‘before’] .= ‘ ‘. _wp_link_page($page-1) … Read more

Can I add a ‘show all pages’ link to wp link pages?

Here’s a suggestion using the wp_link_pages and content_pagination filters: The aim is to add a “Show All Content” link below the content pagination links: and when we click it, the link should display “Show Content Pagination” and vice versa. Demo plugin We can do that with the following demo, where we introduce the wpse_show_all_content GET … Read more

Add a Class to Current Page WP_LINK_PAGES

This is what I use as a replacement for wp_link_pages(). Instead of a separate class it uses another element for the current page, because a page should never link to the current URL. /** * Modification of wp_link_pages() with an extra element to highlight the current page. * * @param array $args * @return void … Read more

error code: 523