Forums › Forums › Search & Filter Pro › Display custom meta value in results
Tagged: custom field meta, display, displaying results, pods, pods.io, results.php
- This topic has 10 replies, 2 voices, and was last updated 5 years, 8 months ago by Trevor.
-
Anonymous(Private) February 12, 2019 at 7:04 pm #202083
Hello,
I am trying to edit results.php that i moved to created folder in my theme folder. i did some testing with echo and that part is done correctly. So, I’m using CPT and i have custom fields in my custom post type “nekretnina” that i’m applying search for and I’m getting the results, but i want to show custom fields from those results that im searching for in my results.
Example.
CPT nekretnina is searched by price,
CPT has the custom meta field brojsobe.How do i call this custom field in the while loop in results.php so that i can show it in my page.
Very Respectfully, Dan.
Trevor(Private) February 13, 2019 at 11:32 am #202096If these are WordPress or ‘normal’ custom fields, see here:
<?php echo get_post_meta(get_the_ID(), 'key', true); ?>
Where key is replaced with the slug name of your custom field.
If they are ACF fields, then it is different. There are examples here:
https://www.advancedcustomfields.com/resources/code-examples/
Anonymous(Private) February 14, 2019 at 12:34 am #202185Thanks for the guidance,
i found out solution for displaying pods CPT with Search and Filter$params = array( 'where'=>"t.ID = '".get_the_ID()."'" ); $mypod = pods( 'nameofthepodyouaretryingtofind', $params ); while ( $mypod->fetch() ) { $name = $mypod->display( 'nameofthefieldinthepod.name' ); } echo $name;
i have additional question though
when im configuring my search and filter
added a post meta field
under
OptionsGet Options:
when its under automatically i get ID’s instead of values
i need to add option manually and rename them, but that will become a pain once stuff get to pile up and when there is always new stuff to add.
any suggestions?Anonymous(Private) February 14, 2019 at 3:05 pm #202271Hi,
Yes it is, but let me explain,
Example
I made a CPT Books
and made an taxonomy Published
Taxonomy in the post Book is in form of a dropdown field that has options from the taxonomy, hence i think it doesnt detect it as a taxonomy but instead of it detects it as an Custom field. i think thats the problem but am not 100% sure.
If i use search field in search and filter called taxonomy i dont get any options because they are inputted as an custom meta in the post itself, should i change all of them to be inputted as taxonomy in the post itself or is there an other way, where i can keep my dropdown custom post field in the post. Because i don’t like the option where an editor can check the checkmark of the taxonomy by accident like the book is “not published yet” and book is “published”All the best, and thanks for the support
Anonymous(Private) February 14, 2019 at 4:11 pm #202305ID’s are correct, and yes i would like to get labels(values of the fields).
Yes, it is seeing it as custom fields in custom meta option, and as well as in taxonomy search option.
when its in custom meta option, when the option is set to automatically it sees ID’s and when its set to taxonomy it sees the values of those fields as it should.Trevor(Private) February 15, 2019 at 10:35 am #202357We intend to work to support PODS with increased integration, as it is a very useful plugin, but right now we support only simple fields and taxonomies. So, as a field, we are currently unable to fetch the title/label associated with the ID number. Are you able to use the taxonomy instead?
-
AuthorPosts