Forums Forums Search & Filter Pro Display custom meta value in results

Viewing 10 posts - 1 through 10 (of 11 total)
  • Anonymous
    #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
    #202096

    If 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
    #202133

    Hi, im using pods for CPT, and search filter plugin is able to search them by their Custom fields. Ill try these solutions you wrote above, hope it works. Will let you know.

    Anonymous
    #202185

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

    Get 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?

    Trevor
    #202224

    Is the field in PODS a relationship field (such as a Post Type)?

    Anonymous
    #202271

    Hi,
    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

    Trevor
    #202277

    So, is Search & Filter seeing the field as a Post Meta or a Taxonomy?

    If it is seeing it as a custom field (post meta) are the IDs correct, but what you want is the labels/titles?

    Anonymous
    #202305

    ID’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
    #202357

    We 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?

    Anonymous
    #202442

    Thanks for the support.
    Could you address me to which file is responsible for fetching the ID of Custom field maybe, maybe i can do something to fetch the label as well.
    We can close this thread with your answer.

    All the best.

Viewing 10 posts - 1 through 10 (of 11 total)