Reply To: Tips on customisation of search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Tips on customisation of search results Reply To: Tips on customisation of search results

#4320
Ernest Marcinko
Ernest Marcinko
Keymaster

Sorry about not answering sooner.

I was waiting for version 4.0 to be approved on codecanyon – which makes result templating possible.

You will be able to make a few changes, but there are of course limitations, because the main result structure should remain the same – as there are javascript handlers attached to them, and too drastical changes might result in a malfunctioning search bar.

You will find the result template files in the ajax-search-pro/includes/views/results/ folder.

I think you are looking for the vertical.php file in that folder. It’s the template file for the a vertical result. On the beginning of that file you will find some advices and descriptions about accessible variables and stuff.

First of all, make a copy of this file, so if something goes wrong, you can still revert it.

This file is called every time a result is generated. The “$r” variable is an object holding some information about the current result. It has the following structure:

$r->id – the ID of the post, term or any result object [always set]
$r->content_type – the content type (post, page, term etc..) [always set]
$r->title – the title of the result [can be empty]
$r->content – the content of the result [can be empty]
$r->author – the author name [can be empty]
$r->date – the date [can be empty]
$r->post_type – the post type (if it’s a post) [can be empty]
$r->ttid – unfiltered list of terms related to the post in [deprecated, do not use]

and of course you can use any available wordpress or plugin function here.

I’m currently working on a new demo, features update and new documentation. After finishing those, there will be a new knowledge base article about this new templating system as well.

If you have experience in php/html/CSS I think you will be able to use it for now 😉

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)