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’
- How do I replace a function, declared inside a plugin’s class, in functions.php?
- Shared functionality in plugins and themes
- Prevent publishing the post before setting a featured image?
- How to Loop Plugin Option Field Set?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- How to load plugin before the wordpress jquery?
- How to count number of records found in a database table?
- Disabling post images for not logged in users
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- Advanced Custom Fields query
- Extend Elementor Archive Posts widget with a custom skin in order to show multiple badges
- HELP: Integrating WP with raw PHP code once published button is hit
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Modifying Footnote Plugin for Descriptive Title Attributes
- I would like to use create a function in my custom plugin to tell WP to use a different header
- How to add pagination to wpbakery grid?
- bulk change of image setting “link to” to “link to: image url “
- Placement of Code in Plugin for hooking `save_post`
- Limit the number of plugins that can be installed in a WordPress installation
- How to get variables from fucntion.php to my plugin files
- WP_Query ordering numbers as letters
- Executing my function once on a specific time
- How to stop or remove an action being called inside a function of an extended class
- How do I “get the next 10 posts after post_id == x”?
- Date calculations from 2 custom fields
- How to debug error message: Cannot modify header information
- DROP TABLE with uninstall hook not working
- How to enable specific plugin only based around shop manager role?
- Adding a new field to the address field type in gravity forms
- Nested shortcode functions accessing variable
- Calling an attribute from a plugin shortcode
- How to set Noindex to all wordpress pages in a catergory?
- Load Javascript from Plugin in One Page Only?
- How to keep variable `$post` to using in another file
- Plugin Development – Functions or Hooks?
- Need to replace Currency Shortforms
- add_query_arg not work in admin
- How do I create a custom permalink structure for a page template
- How to remove a class function from a plugin by using remove_action()?
- Custom query vars filters problem with pagination
- Api external with wordpress
- speed up pagination for huge database
- Hook for altering the content of all wp mails
- How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]
- Sharing functions between plugins
- Delete data from custom table when deleting a post
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- Checkbox show / hide output result
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- How to copy the all WordPress media items to another custom plugin folder?
- WordPress default post categories meta box widget
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Make modification of add_to_cart button specific to single page
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- how can export data in excel file custom plugin
- Only return taxonomies that are linked to a category & product
- How to add specific posts to specific pages in WordPress?
- WP_CRON issue with UTC and local time
- How to wrap image tag into div for post only?
- Update User Meta Via Ajax
- User Following System
- ACF Query result in a new td (echo)
- Multiple Meta key in search
- Unexpected plugin_dir_path Output
- how to repeat taxonomy in different places on wordpress
- how to create table during plugin installation in side a class
- AJAX login without a plugin does not work. when add a action to function.php
- Posting code inside the post instead of in the template file using shortcode
- Metabox Data not saving
- Second foreach loop breaking (Posts2Posts)
- Ger posts from similar tags and categories
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Can’t get custom user meta to show in header
- Including a PHP file via a function that is part of a plugin?
- Building custom pages with a video player
- overwrite a plugin function in functions.php
- Pass strings to plugin function [closed]
- Move related products after product summary? [closed]
- How to tweak a plugin without preventing it from updating
- WP Members additional fields on user profile [closed]
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Display Video as Post Thumbnail
- Notifications Bar on home page only
- How to Add Extra Text In WordPress Title Before Post Publish
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- How can I save the selected page in the dropdown after anyone clicks on Save Changes?
- WordPress Convert queries to slashes using function.php
- Show the author only own types of publications. (JetEngine, Elementor)
- add to cart linking to add to cart page