Add prefix before group name

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

 
Keymaster
1 year ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31218

    Participant

    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

    #31227

    Hi,

    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 :)


    #31235

    Participant

    Thanks 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 ?

    #31236

    Participant

    I also have another question, is it possible to order a specific category at the end of the results always ?

    #31244

    Hi,

    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
    I’m afraid there is no other way.

    Best,
    Ernest Marcinko

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


Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.