Here’s a workaround:
First change the paginate_links()
output type to:
'type' => 'array',
Then we can collect the previous, current and next parts from the paginate_links()
output.
Here’s a simple example where we target the relevant classes:
$next="";
$current="";
$prev = '';
foreach( (array) $paginate_links as $link )
{
if( false !== strpos( $link, 'prev ' ) )
$prev = $link;
elseif( false !== strpos( $link, ' current' ) )
$current = $link;
elseif( false !== strpos( $link, 'next ' ) )
$next = $link;
}
Finally we can construct the output as needed:
! empty( $current ) && printf(
'<div class="pagination">%s %s %s %s %d %s</div>',
$prev,
esc_html__( 'Page', 'my-domain' ),
$current,
esc_html__( 'of', 'my-domain' ),
$wp_query->max_num_pages,
$next
);
Related Posts:
- paginate_links() don’t properly work in search.php?
- How to paginate the get_users function?
- Paged Single Post doesn’t redirect to the main url after Removing Pagination
- How to style current page number (wp_link_pages)?
- Customize “the_posts_pagination” and put list instead div
- Find first image on paginated post for Pinterest
- Post Pagination Showing Same Posts Every Page
- Generating rel=prev and rel=next only on wordpress categories
- Shortcode pagination not advancing
- get_next_posts_link not working without parameter max_num_pages
- Pagination in relation to archive.php
- paginate_links() don’t properly work in search.php?
- the_posts_pagination() function returns missing page numbering on some blog pages
- Custom Query Not Paginating
- Where to call my pagination function?
- Remove ‘page-numbers’ class from prev and next tags
- Modifying the_posts_pagination from within functions.php instead of template files
- Unable to Change “Pages:” Before WP_LINK_PAGES
- How do I make a custom “Read More Blogs” button for my blog page
- I want to customize the_posts_navigation function by replacing prev and next with images
- Shortcode with pagination advancing multiple queries
- Pagination won’t work on custom page
- Pagination not working on my archive page for a custom post type
- Display page number on custom page title function
- WordPress not showing pagination links
- Pagination in Search result
- Adding pagination to custom WordPress function
- Modifying Page-Links format
- WordPress is adding pagination for all pages not only for blog page, How to remove pagination for all pages except blog/posts page?
- Insert image between X number of posts but on specific paginated pages?
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Link to user’s profile settings page?
- Can’t get post ID in functions.php?
- Refresh page after form action
- How to customize search result page title?
- Create new user without password
- Stripping shortcode from custom excerpt function
- Display the number of user comments
- Issue adding text after short description on product pages Woocommerce [closed]
- Custom function for user register in wp?
- Child theme functions.php not executing
- How to add background image control to page admin controls?
- Call function without having to wait on response
- Retrieve post modified date for specific post by post ID
- add a function to submit options.php
- is_user_logged_in not working to redirect only logged out users
- wp_is_mobile dequeue not working
- Previous_post and Next_post – Custom Post Type
- Creating a child theme – functions.php code issue
- Only let plugin add actions to wp_head & wp_footer on single posts
- Setting Up Scheduled Tasks (For Scripts to Run)
- problem with has_post_thumpnail in foreach loop
- Find resources dynamically loading and change or add to the url
- Function wont fire after custom post type is updated
- Removing custom meta data
- Conditional Gravity Forms filter in WordPress Multisite
- When a user logs in, how can they view the website instead of the admin menu?
- WordPress Page Restrict
- Do we have to use ftp to recover from a bad functions.php edit?
- current_time(‘timestamp’) seems to be different from the real current time
- How to get_template_directory() properly on local environment
- content editor format style tags
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Missing argument for the function
- Does size of a theme’s functions.php file matter?
- How to add custom user avatar in wordpress
- custom functions in function file delete automatically daily
- Init action and refresh page after form action
- Replace plugin function with a custom function?
- Delay a function, any function!
- Combine two active_callbacks into one on theme customizer
- How to create shortcode with html and php content?
- Fill empty custom field with other custom field
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- How do I find the code executed when wp_head() is called?
- Editor cannot access Theme Options
- Is this a backup door?
- Include widget file in functions.php of child theme
- Need help making a short code work
- Is there a function for setting a password to a post?
- WordPress functions.php conditional include another functions file
- reWrite wp-content url to point on my cdn
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- sort title descending with title with number
- Add #primary at the end of navlink permalinks on single posts
- Author social media aren’t shown on the page
- Is there anyway to force is_singular() to be true when not loading template?
- Postback redirect through add_action is not triggered
- get_comments not working properly after WordPress v4.4 update
- Retrieve a custom form field modified by a filter
- What add_action reference should I be using or should I use do_action?
- Allow the access over wp-login.php
- Create input select image URL?
- Including one page with WordPress functions into another
- Dynamically Generating User Meta Field
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- Code in functions.php appearing on front-end and dashboard [closed]
- is_preview() always return false