Only return the custom field where the result is found

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Only return the custom field where the result is found

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 3 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28786
    dannyhoodless69
    dannyhoodless69
    Participant

    Hi,

    I have a FAQ page which uses ACF flexible content so every FAQ item on the list uses the following two custom fields.

    question_title
    faq_questionanswer

    Because it’s a flexible content, it generates numbered custom field names so now i end up with loads of them instead of just one per page.

    faq_section_0_faq_questionanswer_1-15

    The search bar is correctly searching the fields and returning the page, but i want the result to display the field number in which the search term was found.

    In this example, the search term was found in FAQ question number 12. Because all the fields are displayed on the same page, it displays every single field all at once instead of just the field that the search term was found in.

    Search preview

    What do i have to do in in order to only show the field that the search term was found in? I currently have the following in Advanced Title Field settings.

    [{faq_section_0_faq_questionanswer_1_question_title}] [{faq_section_0_faq_questionanswer_2_question_title}] [{faq_section_0_faq_questionanswer_3_question_title}] [{faq_section_0_faq_questionanswer_4_question_title}] [{faq_section_0_faq_questionanswer_5_question_title}] [{faq_section_0_faq_questionanswer_6_question_title}] [{faq_section_0_faq_questionanswer_7_question_title}] [{faq_section_0_faq_questionanswer_8_question_title}] [{faq_section_0_faq_questionanswer_9_question_title}] [{faq_section_0_faq_questionanswer_10_question_title}] [{faq_section_0_faq_questionanswer_11_question_title}] [{faq_section_0_faq_questionanswer_12_question_title}] [{faq_section_0_faq_questionanswer_13_question_title}] [{faq_section_0_faq_questionanswer_14_question_title}] [{faq_section_0_faq_questionanswer_15_question_title}]

    {titlefield}

    Hope this makes sense,

    Danny

    #28787
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Danny,

    I’m afraid that is not doable via the advanced title fields.

    The best approach would be to use the asp_results filter to manipulate the result content fields programmatically. In that context you can use the ACF api functions as well.

    Unfortunately we cannot offer customization services, if you need help we usually recommend the Envato Studio.

    Best,
    Ernest Marcinko

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


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

You must be logged in to reply to this topic.