Forums › Forums › Search & Filter Pro › Unable to correctly populate search results with custom field data
- This topic has 8 replies, 2 voices, and was last updated 9 years, 2 months ago by
Anonymous.
-
Anonymous(Private) September 20, 2016 at 4:22 pm #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?
Anonymous(Private) September 20, 2016 at 4:45 pm #59054Actually, 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(Private) September 20, 2016 at 5:02 pm #59056BTW, 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)
-
AuthorPosts