Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Add prefix before group name
This topic contains 4 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 10 months ago.
- AuthorPosts
- January 20, 2021 at 6:21 am #31218
Hi
Is there a way I can add a custom prefix before the group name ?
I am using Terms/Taxonomy grouping. But I have a custom post type named: “Videos”So when I am searching, I see results with different groups. What I want to achieve is wherever I am seeing taxonomies of “Videos”, there is a prefix Video: infront it’s group name.
Example: If there is a category inside video named “Introduction”
It should show “Video: Introduction”Thanks
January 20, 2021 at 1:47 pm #31227Hi,
Well, you can set a static prefix and suffic on the grouping options, but I guess you know that already. Changing them dynamically is not possible, or it would require some custom work for sure, via the results templating feature.
Instead, I would rather suggest using the advanced title and content fields – maybe displaying the list of taxonomies within the descriptions would be an acceptable alternative.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
January 21, 2021 at 6:40 am #31235Thanks for your reply.
Yes, adding it in description shall also do. But I want to show Post Types there instead of taxonomies. Do we have a shortcode for that ?
January 21, 2021 at 6:41 am #31236I also have another question, is it possible to order a specific category at the end of the results always ?
January 21, 2021 at 1:46 pm #31244Hi,
Post type is only possible via custom code, via the asp_results filter. Here is an example usage, where it is printed into the title. The same is doable to the content field as well, just change line 6 to:
$r->content = get_post_type( $r->id ) . ' - ' . $r->content;
You can do that category thing by manually ordering them: https://i.imgur.com/1WdfBYt.png
Best,
I’m afraid there is no other way.
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.