Show taxonomy fields on single posts
-
With the help of https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/ I added some fields to the WP taxonomy ‘post_tag’. With a shortcode according to the following pattern, I display the fields in the sidebar.
function short_func() { $term = get_queried_object(); ... if( get_field('autor') ) { $output .= "<h2>".get_field('autor', $term)."</h2>"; } ... return $output; } add_shortcode('autor', 'short_func' );This works wonderfully on the archive page (tag.php), but not on the single posts (single.php). I read that I had to add something like $post_id or $term_id to the selector. But I am not competent enough to turn the theoretical description into a working script line.
Please, how can I also display the values of the tag fields on the single posts with the corresponding keywords?
The topic ‘Show taxonomy fields on single posts’ is closed to new replies.