Firstly, I’d seriously consider opting for another plugin (it hasn’t been maintained in over 2 years), or making use of WP’s built-in paginate_links
.
But, in the quest to provide a solution, give this a go:
function wp_page_numbers_custom( $wp_query, $start="", $end = '' )
{
$_backup = array(
'wp_query' => @ $GLOBALS['wp_query'],
'max_page' => @ $GLOBALS['max_page'],
'paged' => @ $GLOBALS['paged'],
);
$GLOBALS['wp_query'] = $wp_query;
$GLOBALS['max_page'] = $wp_query->max_num_pages;
$GLOBALS['paged'] = max( $wp_query->get( 'paged' ), 1 );
wp_page_numbers( $start, $end );
foreach ( $_backup as $var => $val )
$GLOBALS[ $var ] = $val;
}
// Example usage: wp_page_numbers_custom( $gallery_query );
Related Posts:
- Dropdown menu on custom page with product to choose number of products per page
- How to call WordPress function other files
- how to use in custom single.php template using php?
- Redirect to another page using contact form 7? [closed]
- Return multiple values in a shortcode attribute
- Pagination not working
- How to Join wp_posts & wp_postmeta table using custom query
- adding dynamic/multiple slug values in ‘option_none_value’
- Elementor: Exclude product categories when using “Source: Current Query”
- FacetWP group listings by custom field [closed]
- Redeclare theme’s function in a plugin
- How to add class in plugin only for network site?
- Pass info from functions.php to plugin
- How does WordPress process plugin installations?
- I have functions in my wordpress plugin. How do I get them to work for me?
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- How can i list random post from multiple category?
- How to create TEMPORARY Download links in a wordpress POST?
- Infinite Scroll for both Index, Category and Archive
- Conditionally add apt. Open Graph meta data to different pages on WordPress site
- PHP Fatal error: Call to undefined function plugin_basename
- how do i remove posts from a WP_Query so the pagination is right?
- plugin development: problem with functions
- add_query_arg not working
- Shortcode button dosent work for all posts. Work for first post only
- Is there a way I can find wordpress posts that don’t contain a word?
- Accessing post’s meta data based on user’s click of a post
- Prevent shortcode from being wrapped in tags
- AJAX button run function
- Change wordpress current_time function to different timezone
- WooCommerce shop page orderby [closed]
- Inserting HTML tag with ACF into shortcode
- Executing my function once on a specific time
- How to append to title via functions.php for auto-posting plugin [duplicate]
- How to stop or remove an action being called inside a function of an extended class
- Get posts from WP_Query and format them on admin_head
- Missing Argument
- load_plugin_textdomain error
- How to override a plugin function wrapped in a class?
- Bootstrap Drop Down menu is not working
- Not getting author rank when using return
- How to Display a Plugin function (content) on frontpage using index.php
- How to query the custom fields by language?
- How do I “get the next 10 posts after post_id == x”?
- wordpress plugin is not activating from widget
- Theme my Login plugin, how to update fields
- Edit Yoast SEO breadcrumbs output [closed]
- Adding Shortcode to Text Widget
- Date calculations from 2 custom fields
- switched from query_posts to WP_query, not working now?
- Admin Panel pagination link styles
- AJAX search posts and pages
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Does WordPress validate inputs to all functions? (such as get_user_meta and insert_user_meta)
- Custom random quote widget breaks when used in multiple sidebars
- Using a function to change favorites listing
- Display post lists in 2nd paragraph
- How to debug error message: Cannot modify header information
- Using a post-signup hook to get user details
- DROP TABLE with uninstall hook not working
- Pagination Broken on Static Pages but Works on Blog Articles
- How to enable specific plugin only based around shop manager role?
- How to change constants in WordPress wp-config.php programmatically?
- Restrict media upload size by format
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- How to display custom sidebar in wordpress 5.5.2
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- How to change this WP_Query to get all ProductIDs and not only specific one?
- creating html reusable blocks via shortcodes
- get current date + 90 days and checking every day
- Adding a new field to the address field type in gravity forms
- Replacing a plugin function with a custom renamed function doesn’t work
- How to create an input field, and base the output on spreadsheet data? [closed]
- Facebook Messager Plugin
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- Fatal error: Call to undefined function cmsms_theme_page_layout_scheme()
- Plugin dropping pagination variable
- Insert content of a post into another
- All sites themes functions.php have been changed
- Customize permalink wordpress category id
- WP_Query and NULL meta keys
- Conditional attributes and logic per product category
- Disqus deleted comments are syncing with wordpress but active comments do not
- Admin style for just one plugin in dashboard
- How to show only next post pagination link using wp_link_pages()
- WP Query. Is there a maximum size?
- WordPress page and plugin list using sql query
- How to remove custom post type and add category and post name
- How to create a custom shortcode based on the layout?
- Using AJAX to generate front end / viewer end pages
- Grab WordPress Salt Data From URL
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- WordPress get_avatar function not correct working
- WordPress metaboxes – textfield suggestion automatically populated
- bbPress plugin: forum lists not showing in correct order? [closed]
- Which file of wordpress manage plugins functionalities?
- How to create an option page for this simple plugin