Forums › Forums › Search & Filter Pro › Display custom field in results
Tagged: custom fields
- This topic has 9 replies, 3 voices, and was last updated 8 years, 11 months ago by Ross.
-
Anonymous(Private) April 24, 2015 at 6:22 pm #15841
OK,
I followed the instructions here so I could modify the results.php file.However, it seems that the results page on the website is still not using the results.php template. I know, as I deleted all the content from the file, uploaded it to the newly-created search-filter folder and nothing changed.
You can test out the search here gotimetrekkers.com to see
I’m sure there’s something simple I’m doing wrong.
Any ideas?
Anonymous(Private) April 24, 2015 at 6:24 pm #15842Sorry, ‘I followed the instructions here…’ http://www.designsandcode.com/wordpress-plugins/search-filter-pro/docs/display-results/with-a-shortcode/
Ross Moderator(Private) May 2, 2015 at 12:03 am #16447Hey there, have you got this working now?
Thanks
Anonymous(Private) January 20, 2016 at 12:41 am #34780Hello,
How did you manage to show the result page if i may ask? Because i can’t get it to work. I’m using advanced custom fields for displaying the custom fields and using Woocommerce for the shop.
I added a customfield on the category page of Woocommerce. Which can be filled in when editing or adding a category in the backend.
I got it to work to display a custom field on the category page of Woocommerce using this:
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
the_field(‘title_informatie_over_categorie’, $taxonomy . ‘_’ . $term_id);
?>But that doesn’t work for the results from Search & filter pro.
Hope to hear from you.
Best regards,
LaurensRoss Moderator(Private) January 20, 2016 at 9:01 am #34798Hi Laurens
The issue I think here is that when using taxonomies, S&F doesn’t actually use a taxonomy query (it uses its own internal query).
So the
get_queried_object
will not contain the taxonomy information you might expect.To get around this S&F has its own method for accessing the query data which should help:
http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/
Thanks
Anonymous(Private) January 20, 2016 at 6:38 pm #34854Hey Ross,
Thanks for your response
. I having kinda trouble getting a Advanced customfield displayed on the (results) category page.On the normal category page of woocommerce the advanced customfield is displayed correctly. But when i start filtering it doesn’t work.
I used some info from the page you posted above. But no results.
Do you maybe have an example? Maybe someone that asked the same question. I couldn’t find it on the forum.
Ross Moderator(Private) January 21, 2016 at 8:13 am #34897Hey Laurens, its not something I’ve come across before, I’ll try to do a quick test again with ACF, but as far as I knew it was working ok.
From what I can see it looks like you are using
the_field
incorrectly:http://www.advancedcustomfields.com/resources/the_field/
It says the second argument should be left blank, OR, the post ID passed.
the_field(‘title_informatie_over_categorie’, $taxonomy . ‘_’ . $term_id);
You are passing
$taxonomy . ‘_’ . $term_id
– this is not hte post ID, so leave this argument out altogether or pass the ID of the current post.Also, I saw a shortcode to get the same info, have you also tried this?
http://www.advancedcustomfields.com/resources/displaying-custom-field-values-in-your-theme/Thanks
-
AuthorPosts