wp_link_page – wrap current page element

I’m trying to make something more meaningful out of the wp_link_pages() result: $paged_page_nav = wp_link_pages( array( ‘echo’ => false ) ); // Now let’s wrap the nav inside <li>-elements $paged_page_nav = str_replace( ‘<a’, ‘<li class=”‘.$classes.'”><a’, $paged_page_nav ); $paged_page_nav = str_replace( ‘/a>’, ‘/a></li>’, $paged_page_nav ); // here I’d need to wrap the currently displayed page element … Read more

When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?

I want to apply different styles for a second page in single.php or posts. How can I do this? I have the following code in single.php to split the page in two parts: <!–nextpage–> If there is a different method to add another “tab” to post or the like, I am grateful for any help… I … Read more

Append a to every post to force additional page link (and static content)

I’m trying to affect either the content or the $post->post_content directly, before the post get read by the wp_link_pages() function, to inject a little bit of static text or javascript after the content of every post on my site. I’ve tried appending it with an add_filter in the functions.php of my theme, but that doesn’t … Read more

Add a Class to Current Page WP_LINK_PAGES

I’ve noticed WordPress has some illogical differences between wp_link_pages and paginate_links. Specifically, WP_LINK_PAGES does not automatically add a class to the current page like paginate_links does. Anybody have a quick functions fix? 1 Answer 1 This is what I use as a replacement for wp_link_pages(). Instead of a separate class it uses another element for … Read more

wp_link_pages: display current page number only if has multiple page breaks?

I’m trying to build a function to display the current chapter (page) within the single.php file ONLY if there’s more than one chapter (page break). This function will output the chapter # within the page header under the title. Then I will customize and use the wp_link_pages at the bottom for the chapter pagination. Currently, … Read more

Customizing wp_link_pages

I want to create a pagenation using wp_link_pages that looks like this Previous 3 of 20 Next How can this be achieved? I am using this function btw https://codex.wordpress.org/Function_Reference/wp_link_pages 1 Answer 1 I don’t see a way to do this with just the standard arguments but you can do it with a filter: function link_hack_wpse_($output,$args) … Read more