
Hi @Christian01
Did you look at the last code example on the linked documentation article?
That example shows how to dynamically find the term_id and taxonomy.
All you need to do is swap get_field to get_field_object

Thanks for the bug report.
I’ll do some local testing and let you know what I find
Thanks
E

Hi @customaniac
ACF v4 comes with a taxonomy select field already!
Cheers
E
Dear elliot
That actually looks exactly like the functionality I need. Is it possible to include this taxonomy-selection into a field in ACF?
edit: ah, I see it probably is possible with this extension of the plugin: https://github.com/GCX/acf-taxonomy-field
Thank you very much for your help.
Best wishes
customaniac

Yep, this has been added to the to-do
Thanks
E

Hi @Christian01
Sounds like this guide will help you out:
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/

Hi @ayottepl
Thanks you very much for sharing this with us!
I wonder if you read over this guide:
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
On that page, there is code to find the current term ID / taxonomy, etc
This would help clean up your body_class code!

Hi @customaniac
This would be best left as a tag taxonomy.
This will also allow you to perform powerful taxonomy queries.
Are you able to use a custom taxonomy?

Hi @funack
I am yet to find a solution for this.
As discussed in the old support thread:
Term meta is stored in the wp_options table (as there is no ‘default’ meta table for terms). Each option_name is prefixed with the taxonomy name + term_id
Like this:
category_2_image => 123
I don’t think it is possible to perform a meta query due to the way data is stored.
Perhaps you could look at another term_meta solution?
+1! This is exactly the kind of feature I requested on the old forum. Such a front-end filter would be immensely useful.
Well I dont know if I understood well, but for me it worked well in 4 languages site.
I’ve created a set of Custom Fields in my main language, but than had to translate this set for the other 3 languages.
Initially I forgot to translate a few fields on the Spanish set, so when I was doing the post translation to Spanish there where some things missing.
But I have other problem. Two of my Advanced Custom Fields are checkboxes populated by taxonomies. The thing is that there is taxonomy of ‘materials’, and some of the material have the same name in all the 4 languages. Things like ‘PVC’. In cases like this WPML adds ‘@en’, ‘@fr’, ‘@es’ in front of the taxonomy term. If I use some WordPress function to list the taxonomy terms the ‘@**” are filtered out… but everything that gets displayed by the ACF functions show those ‘@**’… Can someone help me on this?
Nevermind, the following worked:
<?php
// vars
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
// load thumbnail for this taxonomy term
$thumbnail = get_field('background_image', $taxonomy . '_' . $term_id);
echo $thumbnail;
?>

Hi @treebeard
Sorry mate. Your code contains too make syntax and PHP errors for me to help on this one.
I would advise you to read over the documentation for the image field to find out how it works.
1. Use get_field
2. Address the if statement inside your img src
3. Correct the field names
4. Correct the field return types
5. Your code has no reference to anything taxonomy related
Thanks.
What I’m having trouble with is the code to use. ACF code.
Here’s what I tried that’s not working:
<?php if ( get_post_meta($post->ID, 'my_image', true) ) : ?>
<a href="<?php if ( get_post_meta($post->ID, 'my_image_link', true) ) : ?>"><img src="<?php the_field('my_image'); ?>" /></a>
<?php endif; ?>
This is what I’m having trouble with. When I add the ACF code to load the Taxonomy (which should be converted to a link, since the ACF Link field isn’t working for some reason) I’m not getting a real link, I’m getting a link to a number that goes nowhere.

Hi @treebeard
No worries.
You need to break your task up into easy to tackle stages.
1. Create a field group for the taxonomy, and add an image field.
2. Edit your taxonomies and add the image data for each
3. Create a custom page template an give it a name such as ‘Taxonomy Thumbnails’
4. Create a page in the CMS and use this page template. View the page to see a blank white screen.
5. Search on WP how to get all the taxonomy terms and loop through them. There is lots of documentation for this on the web.
6. Finally, within the taxonomy loop, use the term_id to load in the ACF image data and render the image!
7. Pop open a beer!
Sorry, let me paste what I wrote up there:
“there is no documentation for this particular thing here, no example code”
What I mean is there’s no documentation for what I’m trying to accomplish. I did review the documentation that is available and tried using that to create a link to the category, as I mentioned in my original post:
“I’ve tried messing with the Taxonomy Field (along with the Image field), but couldn’t get that to work as a link (image would link to a number, but it didn’t go anywhere).”

No documentation?
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
Found a workaround using jquery, it works with an ACF taxonomy single select drop down. It moves the add term form to just under the drop down and when a term is clicked from the drop down it populates the add term field and simulates a click on the add button.
The acf select needs to be set to not update terms.
var $j = jQuery.noConflict();
$j(document).ready(function() {
$j("#my_taxonomy").insertAfter("#acf-my_taxonomy_field");
$j("#tagsdiv-my_taxonomy").hide();
$j("#acf-my_taxonomy_field select").change(function(){
var term = $j('#acf-my_taxonomy_field select').find(":selected").text();
//alert(term);
$j('#new-tag-my_taxonomy').val(term);
$j('#my_taxonomy .tagadd').trigger('click');
});
});
sorry for the bother Elliot, it seemed like buggy behaviour but I can see why it’s set up like that now. I was trying to use this method as a workaround for the lack of a way to add a term, previous issue here adding a term with ACF I got this working with javascript, code on the linked issue.
cheers,
Tom
Ok Thank you. Which Code I must use to display only the posts of the selected category from the taxonomy newskategoeie?
Thank you for your help.

Hi @treebeard
The easiest way to do this is to create a field group which contains the image field, and use the location rules to attach this field group to the taxonomy you want.
Now when you edit the taxonomy term you will be able to add an image. Thus associating an image with each term (cagtegory).
A page that shows all the taxonomies? That sounds like a taxonomy archive page and you can read about these on google / wp.org

The taxonomy field (when saving and loading to the post) will remove all connections on save, and then save only the selected connections.
You can’t use this in combination with the WP taxonomy box.

Hi @elliot
Yes, I can see that you have selected a post object (which is titles the same as the category it is in.)
I am now more confused as you have multiple relationship fields…
Can you please start this question again with clarity. And please state what is NOT working, and what IS working.
This is a guess, but on each page, you have ‘right’ and ‘left’ modeuls. In your right 1 module, you want to load in the category which is assigned to the post object of the same name?
Are you using a promo box as a dummy holder for the taxonomy? Or are you loading any extra data from the promo box? Why are your promoboxes called the same as your category?
Hi,
ok I wan’t to descripe the problem.
My Mainsetings for this field are the following. I Think you don’t need more setting information ore did you need some spezial infos?
Feld-Typ: Artikel-Bezeihung
Artikel-Beziehung: News Kategorien
Feld-Typ: Auswahlmenü
Nichts (NULL) erlauben? Nein
Lade & Speichere Einträge im Artikel: Not marked
Rückgabewert: Datei
When I’m looking in the Frontend I won’t get displayed the Newsarticles of the category “News Kategorien”. There will be linked the hello world post and a attchment. But the hello world post is not in the “News Kategorien”. And I have delete them, it is only in the trash folder.
When I put the debug code inside I get this response.
stdClass Object
(
[term_id] => 7
[name] => Category Name
[slug] => category-name
[term_group] => 0
[term_taxonomy_id] => 8
[taxonomy] => newskategoeie
[description] =>
[parent] => 0
[count] => 1
)
There was at [name] an [slug] the right Name inside. But I won’t displays them here.
Thanks E, I really appreciate your help with this.
Does that give you what you need?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.