Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Tips on customisation of search results
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 8 years, 6 months ago.
- AuthorPosts
- March 11, 2015 at 4:47 pm #4188
Hi,
Id like some tips on how i can customise the html output of the search results – so changing the look and feel from the thumbnail image and search icon onhover – to something more specific. I love the live search output function but i need to display different category colours relating to the search results. I assume i can add php tags to do this – so if a result is a person for example that will have a category of people associated which in-turn has a pink-background which id like to add behind the image. the same goes for events or cities, id like to have orange/green backgrounds with their results. please see the jpegs attached. I hope this makes sense.
working site: http://www.humancities.eu/hc2015/
look forward to your response
thanks
PhilipAttachments:
You must be logged in to view attached files.March 12, 2015 at 12:04 pm #4201Any ideas? Here’s the existing search output.. and the above jpeg is what id like it to look like
Philip
Attachments:
You must be logged in to view attached files.March 23, 2015 at 9:25 am #4316Any suggestions at all.. Maybe my request is not clear enough? Please advise?
March 23, 2015 at 9:58 am #4320Sorry 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 :)
- AuthorPosts
You must be logged in to reply to this topic.