Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Custom field data is not displayed in search
- This topic has 7 replies, 2 voices, and was last updated 3 years, 6 months ago by
Ernest Marcinko.
-
AuthorPosts
-
November 8, 2022 at 4:10 pm #39914
sbwestring
ParticipantHello, I have some trouble with advanced custom fields not showing the data in the search results.
Basically I want to use the plugin for searching for staff members. I order to easily translate the fields with WPML, I have two custom fields i want to use:
team_phone and team_email.I use Avada theme, and the staff members are added as FAQ items (as a workaround).
You can have a look at Alexander here where i have added data for phone and email fields. They display fine on the frontend, but in the search bar the field display as “Your content goes here”.
Hope you can have a look, thanks.
November 9, 2022 at 10:58 am #39932Ernest Marcinko
KeymasterHi,
Thank you very much for the details, it helps us a lot!
This is a very intereting issue. I logged in and tried a few different things, and it turns out when the plugin requests the post content, this text is actually returned. I have made a few changes too to see if using different methods would work, but every single time this is returned as the actual post content.
My guess is, that the fusion builder may work differently during the actual page request and within the ajax request. To save resources developers tend not to initialize parts of their plugins during XHR requests (to make it faster), and I believe this is exactly what is happening here. Basically some parts of the fusion builder are not hooked up, so it does not execute the content filters and simply the default text is returned when requested.
I tried to look up their documentation if there is any way to explicitly force the page builder to initialize as in normal requests, but I found nothing. I also looked up all option, no luck either. I am almost certain this is a bug in their plugin, I highly doubt this was intended to work this way.
My best advice here is to use the advanced title and content fields feature. That allows you adding custom fields contents to the live results list, so you can replicate the fusion builder output to some extent.
November 9, 2022 at 11:39 am #39934sbwestring
ParticipantThanks for the reply and looking into it. It works perfect now with the content fields solution you linked to.
I have another question now, is it possible to remove the link on the search result? All the info the user need for the employee is displayed in the search bar, so there’s no need to link to the employee page.Thanks.
November 9, 2022 at 2:01 pm #39936Ernest Marcinko
KeymasterHi,
Sure – the best way to do that is via a custom code:
.asp_r .item, .asp_r .item a { pointer-events: none; }November 9, 2022 at 2:56 pm #39939sbwestring
ParticipantThat works great, thank you.
I have a problem with the search results now. I’ve attached some screenshots, the problem is this:
1. I’ve made the design like this: search bar on left, and empty results box on right.
2. Searching for someone, the results display in the right box.
3. Now the problem is, if i delete what I just searched for, 3 random results will appear in the results box. How can I get rid of this, I just want it to be empty like on step 1.November 9, 2022 at 3:30 pm #39943Ernest Marcinko
KeymasterYou can change that by increasing the number of characters to trigger the search to 1 or more here: https://i.imgur.com/OwFLavM.png
That will do the trick.November 9, 2022 at 3:35 pm #39944sbwestring
ParticipantThat did it, perfect, thank you!
November 9, 2022 at 3:37 pm #39945Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- You must be logged in to reply to this topic.