Custom Fields in Search Results

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 Ernest Marcinko 3 years, 7 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #29157
    RebeccaSidery54
    RebeccaSidery54
    Participant

    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,

    #29160
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

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


    #29210
    RebeccaSidery54
    RebeccaSidery54
    Participant

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

    #29230
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    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:

    .asp_r span.overlap {
        display: none !important;
    }
    Best,
    Ernest Marcinko

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


    #29238
    RebeccaSidery54
    RebeccaSidery54
    Participant

    Great 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!

    #29241
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

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


    #29244
    RebeccaSidery54
    RebeccaSidery54
    Participant

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

    #29245
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

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


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

You must be logged in to reply to this topic.