K
K
Knowledge Base - Ajax Search Pro for WordPress
Buy Ajax Search Pro!DocumentationGet Support
Search…
⌃K
Links
Knowledge Base
Safe Coding Guideline
Hooks
Filters
Templating
Constants
Frontend Filters
Taxonomy Filters
Frontend filters API
Tips & Miscellaneous
Tutorials
Post Types
Taxonomy Terms
WooCommerce
Compatibility
Other
Restrict results from the current author archive page
Presetting search options via a custom URL
Replace search keywords (whole words)
Replace or remove characters from search phrase
How to change the results URL to something else?
Numbering the results
How to use the search without the live ajax feature, as a regular search?
Empty search input field on the search results page
Other
ASP_Query
REST API
Building a custom REST API
Javascript API
Javascript Hooks
Theme Functions
Changelog
Powered By GitBook

Numbering the results

Adding number before each results
​What is this, and where do I put this custom code?​
add_filter( 'asp_results', 'asp_number_results', 10, 1 );
​
function asp_number_results( $results ) {
$num = 1;
foreach ($results as $k=>&$r) {
// Modify the post title
$r->title = $num . ". " . $r->title;
$num++;
}
​
return $results;
}
Previous
How to change the results URL to something else?
Next
How to use the search without the live ajax feature, as a regular search?
Last modified 2yr ago
Copy link