Skip to main content
added 5 characters in body
Source Link
21zna9
  • 381
  • 2
  • 7
  • 19

I'm asking regarding the ACF plugin (Advanced Custom Fields)

I'm working on creating a category group that will add custom fields to the category pages. These are the fields:

enter image description here

They seem to work in storing the data (I can see the data is saved with an example category)

enter image description here

According to the docs, I'm supposed to use get_field in the template files to get the value of the custom field. I'm in the category.php template, and using get_field returns nothing for meFALSE (bool). 

Here is what I've triedmy code:

$sub_heading = get_field("sub_heading");

That should get the sub headingtext that's stored in the "sub_heading" custom field, but instead it just returns nothingFALSE (bool).

I also tried

$sub_heading = get_field("sub_heading", $cat->term_id)

The category page is displaying the category properly, and giving me the title and the description, but nothing is being returned from get_field.

I'm asking regarding the ACF plugin (Advanced Custom Fields)

I'm working on creating a category group that will add custom fields to the category pages. These are the fields:

enter image description here

They seem to work in storing the data (I can see the data is saved with an example category)

enter image description here

According to the docs, I'm supposed to use get_field in the template files to get the value of the custom field. I'm in the category.php template, and using get_field returns nothing for me. Here is what I've tried:

$sub_heading = get_field("sub_heading");

That should get the sub heading, but it just returns nothing.

I also tried

$sub_heading = get_field("sub_heading", $cat->term_id)

The category page is displaying the category properly, and giving me the title and the description, but nothing is being returned from get_field.

I'm asking regarding the ACF plugin (Advanced Custom Fields)

I'm working on creating a category group that will add custom fields to the category pages. These are the fields:

enter image description here

They seem to work in storing the data (I can see the data is saved with an example category)

enter image description here

According to the docs, I'm supposed to use get_field in the template files to get the value of the custom field. I'm in the category.php template, and using get_field returns FALSE (bool). 

Here is my code:

$sub_heading = get_field("sub_heading");

That should get the text that's stored in the "sub_heading" custom field, but instead it just returns FALSE (bool).

I also tried

$sub_heading = get_field("sub_heading", $cat->term_id)

The category page is displaying the category properly, and giving me the title and the description, but nothing is being returned from get_field.

Source Link
21zna9
  • 381
  • 2
  • 7
  • 19

get_field not displaying my custom field value

I'm asking regarding the ACF plugin (Advanced Custom Fields)

I'm working on creating a category group that will add custom fields to the category pages. These are the fields:

enter image description here

They seem to work in storing the data (I can see the data is saved with an example category)

enter image description here

According to the docs, I'm supposed to use get_field in the template files to get the value of the custom field. I'm in the category.php template, and using get_field returns nothing for me. Here is what I've tried:

$sub_heading = get_field("sub_heading");

That should get the sub heading, but it just returns nothing.

I also tried

$sub_heading = get_field("sub_heading", $cat->term_id)

The category page is displaying the category properly, and giving me the title and the description, but nothing is being returned from get_field.