WP_Query
has a $post_count
variable.
http://codex.wordpress.org/Class_Reference/WP_Query#Properties
Just pass that with the script using wp_localize_script
Related Posts:
- How can I pass a variable to wp_ajax action?
- How to pass JavaScript variable to PHP in wordpress widget?
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- ‘Lazy loading’ list of posts with pagination
- Errors while using ajax from external wordpress page
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How to use wp-ajax in wp-cron
- How to add pagination to wpbakery grid?
- WordPress Ajax Callback
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- WooCommerce get_price returning wrong price when used via ajax
- Shortcode button dosent work for all posts. Work for first post only
- How to put JQuery/Ajax inside shortcode?
- Using a custom plugin to capture input data via Ajax and PHP
- Set and access global variable
- Ajax call returning 0
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- Init plugin again after ajax call finish
- Using color picker in plugin, does input attribute order matter?
- Redirect to another page using contact form 7? [closed]
- Call plugin with php function
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- wordpress add_action() issue in ajax call
- How to get specific string/value from an array? php [closed]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Asynchronous request in wordpress
- Plugin not working locally, but works on server
- Ajax call not working in wordpress through a plugin
- Send Array from JS to php file then insert it in wp database through a plugin
- can’t unzip file
- Strange admin-ajax / CSS / $_SESSION issue
- How do I reinit WordPress plugins dynamically using jS?
- How can I adjust my function so the page editor still loads in the backend?
- WP Ajax DB issues
- Calling PHP function with AJAX
- In a plugin, How to update a json file using ajax
- Can you add a shortcode to a custom post type that gets the post_title, post_content, etc. and then passes that to a plugin function?
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- How to use Datatable with Ajax when creating plugin on WordPress?
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- wp-admin/admin-ajax.php 400 (Bad Request) plugin
- Defining constant in a plugin to use in another plugin
- Ajax call to php function doesn’t work PHP code
- How to display variables from plugin?
- Compare Ajax Data Results
- Conditional Fields depending on checkboxes
- Help with customising love it plugin (use within foreach)
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Creating new option (add_option) from AJAX – Settings API
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Editing Global Variables from Inside Functions
- AJAX doesn’t pass variables to the php function in the plugin
- How do I convince this button to do something when it is clicked?
- display user input using ajax in wordpress
- Hyperlink to execute PHP
- How to get site homepage from plugin?
- Pulling Advanced Custom Fields from other pages
- Response from Php File to Ajax is not getting sent
- Help me with my first very basic plugin
- WordPress portfolio pagination on home page
- How do I call an action hook into wp_ajax hook callback function
- How to build an API as a plugin
- Loading shortcode with ajax
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- Calling a plugin in theme development
- Unable to activate wordpress importer after installing it
- Form isn’t inserting data into database with ajax plugin
- How would I go about creating a user ranked post popularity page?
- WordPress: PHP code rendering in the wrong place
- How to edit content before post update
- Customize permalink wordpress category id
- Take input from form and pass it to function using a wp-plugin
- Load Javascript from Plugin in One Page Only?
- Why is one phpunit test throwing an error on one class when all other classes are similar without error?
- Setting Up PHP Workflow in WordPress
- Is it safe to use admin-ajax.php in the frontend?
- Create WordPress posts from JSON array using plugin in admin
- How can I exclude a dynamic URL to show a popup created using ‘WordPress Popup’ plugin
- output html on post or page from custom plugin [closed]
- Way to send multiple values for column to MySQL?
- Searching a tab/space delimited text file based upon form criteria and returning a ‘record’ into a word press results page
- WordPress is redirecting me to homepage
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Redirect to a page while maintaining search query parameters without causing an infinite loop
- How to ignore fields if empty?
- Moving a few select DB tables to a new WP instance
- Update User Meta Via Ajax
- User Following System
- How to get the total count of Favorite/Favorited authors
- Admin login substantially slower on production server
- redirect to a custom page
- How to change text in a page by utilizing a custom user id?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- How do I output user_registered time in my correct timezone?
- Creating a press page for our project
- how to search through plugin in wordpress cimy-user-extra-fields?
- Translate text for empty product
- How to get URL param for pagination in shortcode?
- How Create LastMod and Update Date Only on Taxonomy Category and Tags