Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Custom Fields in Search Results
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 2 years, 9 months ago.
- AuthorPosts
- August 27, 2020 at 11:58 am #29157
Hi there,
Is it possible to have a dropdown filter showing results from an ACF Relationship field and also display text/url related to the ACF Relationship field in the results?
I understand your templates can be modified via child templates in my custom theme, but wanted to check on the possibility of adding code in the child template to do what’s required?
Thanks,
August 27, 2020 at 2:08 pm #29160Hi,
Unfortunately no, that is not possible to do without major custom coding. Filtering might be impossible even then, as the field values are not stored in the meta field.
To display the field values, you will have to check the ACF relationship field api and depending on the use case integrate it with the asp_results hook within the search plugin. This is not an easy task whatsoever, please be very careful when custom coding.The full templating guide can be found here. I only recommend this feature, if you want to make major changes to the output structure. If you only want to add values to titles, contents etc.. then the upper mentioned asp_results hook is much better for that.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 1, 2020 at 6:08 pm #29210Thanks Ernest,
I’m basically trying to display a custom taxonomy (AUTHOR) term name at the bottom of each result, but I also want to manipulate the URL to link to another page with a similar slug, so it seems the best place to do this is in a child template?
So far I’ve tried this:
<a href="/our-people/<?php echo str_replace(' ', '-', strtolower('Term Code To Replace')); ?>"> <div class="card-author"> <?php echo $r->id; ?> </div> </a>
So if I wanted to display a custom taxonomy term, how would I code that?
I also noticed there is an overlay span to link the entire result – can this be turned off via the plugin or just via css?
Thanks!
-
This reply was modified 2 years, 9 months ago by
RebeccaSidery54.
-
This reply was modified 2 years, 9 months ago by
RebeccaSidery54.
September 2, 2020 at 2:51 pm #29230Hi,
For replacing the result URL (or parts of it), I would rather recommend using the asp_results hook, here is this example.
For post type results, you can use the advanced title and content fields to display taxonomy terms in the result content or title fields.
I would recommend using a custom CSS to remove the overlay. There is an option, but the node still remains there, so use this if you want to make sure:
Best,.asp_r span.overlap { display: none !important; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 3, 2020 at 3:48 pm #29238Great thanks for the feedback – was very helpful,
I have another question. What is your plugin like in terms of SEO – say if I used it as a category page and the results div as the posts?
Thanks again!
September 4, 2020 at 12:46 pm #29241Hi,
It should not affect the SEO, ajax requests are usually not considered in the initial page load.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
September 4, 2020 at 2:31 pm #29244Thanks Ernest,
Sorry for all the questions, is there a fallback in the event of javascript being turned off? This will affect the decision for us to use the plugin soley for category navigation.
September 4, 2020 at 2:46 pm #29245You are welcome.
Unfortunately no, the plugin needs javascript to work.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
-
This reply was modified 2 years, 9 months ago by
- AuthorPosts
You must be logged in to reply to this topic.