Why an arbitrary field returns 0?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
55 views
Good day, tell me that not doing the right thing
On each column will be inserted a picture which relates to the theme of this column
He created an arbitrary field using the plugin Advanced Custom Fields to add images to the headings joxi.ru/a2XzJePTyNp3br
So put in the code
joxi.ru/bmoE8O7iMRlLjA
The problem is that the picture is inserted only when a category has no entries
joxi.ru/Drlg1Okc49dRzA
As soon as add a category entry in the url, nothing is transferred
joxi.ru/eAOzn4jT4JGRB2
by | 55 views

2 Answers

0 like 0 dislike
The problem is that fields ACF category works a little differently
Here off. documentation https://www.advancedcustomfields.com/resources/add...

In short:
// Need to define a variable with the current category
$term = get_queried_object();

And your code will look like this:
<?php $term = get_queried_object(); ?>\r
by
0 like 0 dislike
try this
by

Related questions

0 like 0 dislike
1 answer
asked May 22, 2019 by TosterUserName
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users