
Hi @olethomas
Thanks for the bug report.
I’ll add this to the to-do but have a feeling I have fixed this issue in the current nightly build on github.
Are you able to test out this latest version?
Thanks
E

Hi @surfsup74
If the field is specific to the term, then you need to move the code WITHIN your terms loop and also use the $post_id parameter to target the taxonomy term.
You have done this correctly with the ‘term_thumbnail’ field, but for some reason, you have not followed this methodology with the ‘moduleclass’ field

It looks like you are using a text field for the hair_color field rather than a select/option field.
So try any of these:
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
$hair_color = get_field('hair_color', $taxonomy . '_' . $term_id);
echo $hair_color;
?>
<?php
global $post;
$taxonomy = "someting";
$terms = get_the_terms($post->ID, $taxonomy);
if( !empty($terms) )
{
$term = array_pop($terms);
$custom_field = get_field('hair_color', $taxonomy . '_' . $term->term_id );
// do something with $custom_field
}
?>
See this example for more info: http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
If you do want to use a Radio Button field type and have them choose from a list of hair colors, then this might work too (I think):
<?php
$field = get_field_object('hair_color', $taxonomy . '_' . $term->term_id);
$value = get_field('hair_color');
$label = $field['choices'][ $value ];
echo '<p>' . $label . '</p>' ;
Probably didn’t work before due to being text field rather than select/radio field and the $taxonomy value not being defined, although not sure…

Looking at the PHP docs,
This is a function as of PHP 5.2.0
Perhaps you will need to upgrade the PHP version running on the server?
Elliot,
I switched to Twenty Thirteen and only have ACF activated. This is the error I get
[17-Sep-2013 13:12:29] PHP Fatal error: Call to undefined function filter_var() in /var/www/hlacharterschool.org/wp-install/wp-content/plugins/advanced-custom-fields/core/controllers/everything_fields.php on line 266
[17-Sep-2013 13:12:29] PHP Notice: ob_end_flush() [ref.outcontrol]: failed to delete buffer zlib output compression. in /var/www/hlacharterschool.org/wp-install/wp-includes/functions.php on line 2765
🙂 fantastic, will test this out in the next couple of days, thanks
Must’ve been something with the field name. I added a new field with the name cm_id and it worked.
I’m having the same issues. I’m using WooCommerce, WPML and ACF. WooCommerce creates a custom taxonomy called ‘product_cat’. The name of the field I’m trying to get is ‘Subscribe Field Name’.
I’m using the following, but it’s not returning anything:
<?php echo get_field('subscribe_field_name', 'product_cat_16');?>
It’s driving me crazy.

Good news. I have just added and pushed to github an update for the taxonomy field.
This update contains a new filter allwoing you to customize the args used in the wp_list_categories function.
You can use it like so:
add_filter('acf/fields/taxonomy/wp_list_categories', 'my_taxonomy_args', 10, 2);
function my_taxonomy_args( $args, $field )
{
// do stuff to $args
return $args;
}

Are you able to deactivate all other plugins / change to default theme.
I understand that ACF is causing the issue, but perhaps it is not the root of the problem. Perhaps the problem comes from another plugin and then ACF trips up.
Thanks
E

Hi!
First off, move wp_reset_postdata(); right under the endforeach; in your related posts loop.. that should fix the error with the incorrect ID.
Secondly.. there doesn’t seem to be a default archive link for posts if you don’t include a date or category tag (like http://www.demo.com/2012/). I honestly cant think of a smooth way to solve this the way it’s set up at the moment.. If I where you I’d either rethink it all or id create categories thats named the same as the companies but with a permalink of something like companyname-cat and assign the posts to them as well. That way you could just put this for the readmore link:
<?php
$cat = get_category_by_slug($post->slug.'-cat');
$catlink = get_category_link($cat->term_id);
?>
<a href="<?php echo $catlink; ?>">View all</a>
then you can check in archive.php if it’s trying to display a category with
if(is_cat()){
//the archive is displaying posts from a category
}
If this solution doesn’t work you could create a custom taxonomy and assign it to the posts (besides categories and tags) and use them instead and change the functions accordingly..
<?php
$cat = get_term_by('slug, '$post->slug.'-cat', 'your-taxonomy-slugname');
$catlink = get_category_link($cat->term_id);
?>
<a href="<?php echo $catlink; ?>">View all</a>
and:
if(is_tax()){
//the archive is displaying a term from a taxoonomy
}
Ok I created a new code:
// add the __() functions for theme translations (by BaLu.LT)
$ignore_keys = array(
'id',
'key',
'name',
'type',
'field',
'operator',
'value',
'allorany',
'formatting',
'position',
'layout',
'save_format',
'preview_size',
'library',
'param',
'toolbar',
'media_upload',
'date_format',
'display_format',
'return_format',
'taxonomy',
'field_type',
'default_value'
);
$ikeys = "";
foreach ( $ignore_keys as &$ikey ) $ikeys .= "(?<!\'" . $ikey . ")";
$regular_expression = "/((?<=" . $ikeys . "\' => )\'.+\'(?=,))/";
$html = preg_replace( $regular_expression, "__($1, 'acf_export')", $html );
Few things to mention:
No translation support for ‘default_value’ using it as default text (alternative: placeholder)
No translation support for choices with identically matched keys to any of $ignore_keys or if it’s an integer

Currently, there is no filter for the wp_list_categories args within the taxonomy field.
You can edit the core/fields/taxonomy field to add on in, however this may be removed after updating.
I’ll add this to the to-do and add it into the core.
Cheers
E

Are you able to turn on DEBUG MODE in your wp-config.php file and reload the page. Is any error message shown?
It is possible that the error is caused by the page taking too long to load. What if any fields have you added to the user / taxonomy page?
Thanks
E

Hi @greenish
Thanks for the info.
May I ask what edit screen you are saving the data on? On a normal post / page, or a taxonomy, user, options page?
The issue is either 1 of 2 things:
1. Running out of PHP memory or hitting a max vars limit during the save – easiest way to solve this is check your server error logs and increase the available vars / memory
2. Your field names are too long to save into the DB – this an happen when saving to a taxonomy, user or options page as these tables have different character limits on the meta_key value
Hope that helps find the issue!
Cheers
E

Hi @wightfield
Yes, this will be included in the NEXT version
Thanks
E

Hi @juxprose
Thanks mate. Can you change this topic to a question and mark the appropriate reply as the solution?

Thanks Elliot, my echo wasn’t correct, your ‘<?php echo $specialtopic->name; ?>’ fixes the problem just as I’d like.
Many thanks for your time looking at this, and the fix.
Thanks
Dave
Hi Elliot
Thanks for your reply. It looks like the Metabox/No Metabox doesn’t show title when used for a taxonomy. I think it would be a nice feature to add in the future.
Congratulations on a nice framework. I’ve tried various one’s and this seems the best.
Thanks
Paul

Hi @bissy
Thanks for the clarification. So you are looking at a post (single.php) and trying to load the color of the connected category?
This is covered in the following tutorial:
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
You will find an example showing how to get the connect term data too
Thanks
E

Hi @bissy
So you are having issues loading the data?
Have you read this guide:
http://www.advancedcustomfields.com/resources/how-to/how-to-get-values-from-a-taxonomy-term/
What code are you currently using? On what template file?

Hi @juxprose
Because you have selected ‘Term Object’ as the return type, you are getting an object (just like you have chosen).
This object can be seen clearly in your var_dump.
Is there a problem that I am not seeing? Do you need help rending the object? This would work:
<?php
$specialtopic = get_field('specialist_topic', 'user_' . $curauth->ID);
?>
<h3><?php echo $specialtopic->name; ?></h3>

Hi @wightfield
Thanks for the request.
Currently, the taxonomy edit page does not show any fiedl group titles, however, depending on the layout option (metabox / no box), the title should be shown.
I’ll add this to the to-do and have this included in the next version
Thanks
E

Hi @timshutes
Unfortunately, at the moment, a text field will be your best bet.
That or creating a new field type which includes the archive URLs you seek.
If you feel up to creating a new field type, there is plenty of docs and even a starter field template file to get you started over on the docs page!
Good luck
Thanks
E
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.