My mistake, i have found it, thanks
Hello,
i’am sorry, didn’t saw the e-mails from this post.
The code has changed – don’t know why anymore.
But this worked for me:
<?php
$term_id = get_queried_object()->term_id;
$post_id = 'product_cat_'.$term_id;
$custom_field = get_field('ACFFIELD', $post_id); // My Advanced Custom Field Variable
?>
<div id="seo-text"><?php echo $custom_field; ?> </div> <?php // Get Advanced Custom Field Value ?>
You have to add it in the archive-product.php under the last div and below the footer.
If you have a child-theme, you need to copy that php file to your child theme with the same template structure. Research how to overwrite template files in your child theme.
Here again:
</div>
<?php
$term_id = get_queried_object()->term_id;
$post_id = 'product_cat_'.$term_id;
$custom_field = get_field('cat-seotext', $post_id); // My Advanced Custom Field Variable
?>
<div id="Seo-text"><?php echo $custom_field; ?> </div> <?php // Get Advanced Custom Field Value ?>
<?php get_footer(); ?>
best luck
I’am not that good at coding, english & thinking ;), but try and error works.
<?php
$queried_object = get_queried_object();
$taxonomy = $queried_object->taxonomy;
$term_id = $queried_object->term_id;
the_field('youracffield', $taxonomy . '_' . $term_id);
?>
does it.
Hi
i do something wrong. The first part already works, but i can’t display the value. I want to create a new “SEO text field” and added an wysiwyg-field, which show up at every category.
But
<p><?php the_field('myafcfield', $term); ?></p>
<p><?php the_field('myafcfield', $taxonomy); ?></p>
dont show anything. I have the right template and cache is disabled.
what i have todo ?
regards
waterlemon