Forums Forums Search & Filter Pro Unable to correctly populate search results with custom field data

Viewing 8 posts - 1 through 8 (of 8 total)
  • Trevor
    #58919

    What S&F Display Results method are you using? The shortcode method gives you a custom results template to play with. Check the documentation for how to start using that template:

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    Trevor
    #58921

    Ah, but reading another post I see you already knew that 😉 So, for now, Are you using the Shortcode method?

    Anonymous
    #59040

    Yes. We are using a shortcode.

    Our setup is that we have some custom post types made in pods with custom data fields in each post. Search and Filter can return and filter the results fine using the standard results.php template. When we copy the results.php and rename it to be used as a custom results page, it works fine too.

    However, when we try to customize the results page by creating a custom layout, it does not return the datafields. I have a feeling that I’m doing something really obtuse.

    To be more precise, we have a custom pods post type which is identified as ‘game_site’ without the quotes. In this post type, we have a field called “game_type” which is named “game type”. If I wanted to return this specific field as an h2 tag using php echo, how would I do that?

    Trevor
    #59042

    Have you checked the pods documentation?

    Anonymous
    #59054

    Actually, I found something that looks like it works.

    <?php echo get_post_field('game_name', $post_id); ?>

    This basically looks like it will echo the value in that particular field for that particular post.

    It’s a bit confusing since I’m by no means a php expert, and anything related to the appropriate search terms returns a million things about getting post meta stuff, which didn’t work for me (probably since I have no clue about this stuff but the examples looked kinda appropriate).

    Anonymous
    #59056

    BTW, the solution in the pods documentation would be great for a static page, but on a search results page it basically “over wrote” the search results and would display all of the custom post type entries (ie, if there were 50 game sites total, and the search should only show 30, when implementing the pods code within the return.php along side the other code it would return all 50)

    Trevor
    #59071

    So, did you manage to fix this or is it still broken?

    Anonymous
    #59075

    Yes, doing

    <?php echo get_post_field('game_name', $post_id); ?>

    fixed the issue, it can be closed.

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