This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Add prefix before group name

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Add prefix before group name

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31218
    uniconta18uniconta18
    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
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

    #31235
    uniconta18uniconta18
    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
    uniconta18uniconta18
    Participant

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

    #31244
    Ernest MarcinkoErnest Marcinko
    Keymaster

    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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.