Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Information about setting the plugin
This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko 6 years, 5 months ago.
- AuthorPosts
- June 7, 2017 at 12:13 pm #13400
I’m currently testing the plugin and I find it very good. There are three things I do not find in the knowledge base and I would need to know if it can be done and how.
The first is whether you can exclude posts based on the result of a custom field. I have not seen it but I know that with the basic wordpress search it can be filtered via function.php
The second is if I can put the post type in the search result (in “Advanced Description Field”) to differentiate the post from each other. Maybe by adding a css class to each of the results. I’m not sure if this can be done without modifying the plugin code.
Finally, in Advanced title field comes by default {titlefield} that can be set before. What is the tag for the “Secondary Title Field for Posts / Pages / CPT” and “Secondary Description Field for Posts / Pages / CPT”
Many thanks for the advice and as I said before, this plugin is excellent. I’m sorry for my English, I’m in the learning phase 🙂
June 7, 2017 at 11:43 pm #13441Hi!
Thank you very much for your kind words!
Exclusion by custom field value
Actually it is possible, both ways, either by an option or using a custom code. Let’s try the option first, and if that’s not working, then we can try a custom code. The key to solving this is that the plugin offers certain filters, and one of them is a ‘hidden’ custom field filter. So even if you don’t use the filters at all, this one still applies. To create a hidden filter, go to the Frontend search settings -> Custom fields panel: https://i.imgur.com/eKOPUxB.pngPlease note that in this solution the search will include the results matching the value defined – so it’s rather an inclusion then an exclusion. If you have numeric fields, make sure to use the numeric operator instead of the ‘LIKE’ and ‘EXACTLY LIKE’.
Post type name in the content
It’s also possible, but only with a custom code. I believe this knowledge base article will help you: https://wp-dreams.com/knowledge-base/showing-the-post-type-name-in-post-title/
If you want to add the post type to the content then change this line:$pageposts[$k]->title = $post_type . ‘ – ‘ . $pageposts[$k]->title;
.. to something like:
$pageposts[$k]->content = $post_type . ‘ – ‘ . $pageposts[$k]->content;
Primary and secondary fields
There is no tag for that unfortunately. That tag represents whichever field was chosen automatically. If the primary field source is empty, then the secondary is used.I hope this helps!
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.