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
Hi @seamusleahy
Taxonomy fields are not yet supported in the acf conditional logic triggers.
I would suggest that you write some custom jQuery and add it to the edit page. This jQuery could hide / show the field based on a taxonomy value.
Good luck
Thanks
E
I was wondering if this had been added or if you knew a way to roll my own solution? Basically i’m looking to be able to hide and show fields based on the taxonomy selected.
Hello.
Any progress on this issue?
I’m using CPT-onomies (http://wpdreamer.com/plugins/cpt-onomies/) to create CPT/taxonomy combinations and can’t seem to assing taxonomies to users with ACF. CTP-onomies are a big part of my current project.
Do I need to resort to using a custom term save function with users for now?
EDIT: it seems CPT-onomies uses its own system for handling taxonomies. it doens’t utilise the default taxonomy tables in the database, but saves them to meta data instead. Nevermind, will need to create my own system anyways it seems.
ahhhh!
Actually your code should work but you need to change it to this:
<?php
$selected = get_field('q_and_a_category_select');
$args=array(
'post_type' => 'q-and-a',
'q_and_a_category' => "$selected" //the slug for the custom taxonomy term
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; }?>
<?php wp_reset_query(); ?>
you could put the get_field directly in the array but I think this looks more structured 🙂
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.