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 to export comments in WordPress?
- How can I call a function from one plugin within another plugin?
- Gutenberg disallow certain custom blocks but keep all core blocks?
- Remote upload file to server B
- Publish author posts only with editor approval?
- Using functions from a plugin in your theme
- Keep one user logged for a year?
- Customizing subject in comment notification e-mails
- WP showing “warning: call_user_func_array()”, What to do?
- Declare a function before plugin does on the theme functions.php file
- Generate Advanced Custom Fields box in custom admin menu page
- How to turn off email you receive when registered?
- Removing user contact methods works from functions.php but not from a plugin
- Execute a function using ajax
- Comparisson between date() and a date from wp_postmeta
- How to extract images of post and pages excluding header and logo image in wordpress?
- Use functionality of 2 wordpress plugins
- Woocommerce custom loop to show all the products [closed]
- How can i change an image’s author?
- Converting a simple plugin to be placed inside of functions.php
- Set WordPress Featured Image For All Post Slugs Matching Image File Name in Specified Directory
- Showing Co-Authors on post page
- jQuery Plugin to use WordPress functions in AJAX request
- Debugging Technique Question re: functions.php
- How use %like% in sql statement wordpress
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- How to include code into functions.php file via a plugin
- Custom Taxonomy Tag Search
- FacetWP group listings by custom field [closed]
- Redeclare theme’s function in a plugin
- I have functions in my wordpress plugin. How do I get them to work for me?
- Change wordpress current_time function to different timezone
- How to override a plugin function wrapped in a class?
- Edit Yoast SEO breadcrumbs output [closed]
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- Using a post-signup hook to get user details
- Restrict media upload size by format
- Calling plugin function inside custom plugin for onclick event
- Show function to super admin
- Facebook Messager Plugin
- Using AJAX to generate front end / viewer end pages
- Cannot get wpdb data (Error in a simple fuction) [closed]
- Basics of changing plugin output
- Help with WP Business Directory Manager Plugin?
- Error in pdf generating plugin using FPDF
- get specific value of a array | PHP
- Loading a plugin’s js file from functions.php
- Loop returns the current page’s permalink and guid instead of the post in the loop
- How to access OOP plugin function inside themes or other plugin
- Different registration form for different roles
- Can you echo PHP code from a variable?
- How to find the WordPress Nextgen galleries which are not used in WordPress posts?
- How to disable Wp-PageNavi at the top of the page
- Elementor Pro display featured image on section -> style -> image using shortcode
- Create a pdf from the entries in DB
- RSS feeds for specific topics
- Use get_pages() before another plugin modifies it
- add_rewrite_rule to load different page, without changing URL in browser
- What database state changes happen after a post is manually “updated” with no changes?
- Overriding a function in a WordPress plugin
- Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /../plugins/rm-payment.php
- Submitting form to PHP
- Adding discount functionality to the cart
- Precheck fields when I add a new post
- Get Shortcode output to database for static post_content
- Use buddypress function outside of plugin
- How use get_plugin_updates() function?
- how override a define
- WPML – Hook when language is switched (change user language)
- Use action, filter, or hook to append HTML to WordPress plugin function
- Change custom rewrite rule when permalink is updated/changed
- PageNavi redirects to 404 when used as archive page
- Save Post Permalink In .txt File
- How To Add Code To WP Without Plugin or Functions
- Disqus comments count taking long to update
- plugin not hooking to my custom hook
- Populate select option with JSON file
- Home page letters
- Find all strings between an enclosing shortcode
- Plugin does not create a custom table upon activation
- WordPress filter function using query modifications
- homepage olderposts link showing page not found
- Insert data in custom table during new post creation
- Trying to output a “Most visited blogs” list in wordpress multisite
- How to disable register and reset the password from WordPress admin panel?
- wordpress Search function is not working
- PHP Creating a formula from mysql db values and db stored math operator
- filter just a portion of plugin function
- Make plugin admin page visible to other roles
- wp_enqueue_script doesn’t load JS in plugin
- Order custom post type by posts with most likes first
- Accessing Correct Database to Create REST API Endpoint