K
K
krinbin2018-02-13 22:28:36
metadata
krinbin, 2018-02-13 22:28:36

How to display custom ACF fields in Wordpress tags?

Greetings.
Task - Display a custom field (heading h1) for tags in WP. If the field is filled, display it, otherwise the standard name.
I don’t know if the topic is to blame or not, but I didn’t try everything in the end on the records - ok, on the categories - ok, on the tags - no.
For categories, this option works -
$title = get_field('h1', "category_".get_query_var('cat')) ? get_field('h1', "category_".get_query_var('cat')) : single_cat_title('', false );
Help to draw the correct output for the tags.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
krinbin, 2018-07-25
@krinbin

Earned such an option, maybe someone will come in handy.
get_field('h1', $taxonomy . '_' .$term_id) ? get_field('h1', $taxonomy . '_' .$term_id): single_tag_title('', false );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question