K
K
Knowledge Base - Ajax Search Pro for WordPress
Buy Ajax Search Pro!
Documentation
Get Support
Search…
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
Building a custom REST API
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?
1
add_filter
(
'asp_results'
,
'asp_number_results'
,
10
,
1
);
2
3
function
asp_number_results
(
$results
)
{
4
$num
=
1
;
5
foreach
(
$results
as
$k
=>&
$r
)
{
6
// Modify the post title
7
$r
->
title
=
$num
.
". "
.
$r
->
title
;
8
$num
++
;
9
}
10
11
return
$results
;
12
}
Copied!
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
1yr ago
Copy link