Knowledge Base - Ajax Search Pro for WordPress...
Knowledge Base - Ajax Search Pro for WordPress...
Buy Ajax Search Pro!
Documentation
Get Support
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
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?
Other
Javascript API
Javascript Hooks
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 updated 9 months ago