Reply To: A variety of topics


Ernest Marcinko

I hope you had a Happy Christmas too 🙂

That is exactly the solution what I was thinking of, but it is a bit difficult, as you will have to make changes to the result template files.
Before starting, I suggest quickly reading through the Results templating knowledge base article. In short, it’s a similar way of making direct and permanent changes to the HTML output of the results using a template system, similarly to WooCommerce.
Basically, you need to make a new folder in your theme directory, then copy the result template files from the search plugin folder to that, where you can modify them – it is all explained in the article.

Then, depending on the result layout you have, you open the corresponding template file. Let’s say, you use the vertical layout, so then:
– Open the vertical.php file
– then scroll to line 49-53, which prints the result heading and the link elements, it looks like this:

– Now, the $r variable holds the result object, and the $r->post_type holds the post type, if this is a post type result, otherwise it is not defined. My solution would be to add the asp_res_{post_type} class to each result, which will result in asp_res_post for posts ‘ asp_res_page for pages etc.. For that, change those lines to:

Now, for each post type, the asp_res_{post_type} class will be added to the link element, so you can target them with CSS rules, like:

a.asp_res_post::before {
    /* CSS rules for posts here */

a.asp_res_page::before {
    /* CSS rules for pages here */

That should help you get started with this.

Ernest Marcinko

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