> For the complete documentation index, see [llms.txt](https://knowledgebase.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.ajaxsearchpro.com/miscellaneous/other/numbering-the-results.md).

# Numbering the results

[What is this, and where do I put this custom code?](/safe-coding-guideline.md)

```php
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;
}
```
