Home Forums Front-end Issues Using Code Snippets to display custom field.


Using Code Snippets to display custom field.

  • Hello, I am not very familiar with any of this, but any help would be greatly appreciated!

    I am trying to display the custom field on the front end of my site on all my category pages. Here’s what I have so far:

    add_action( ‘feast_after_archive’,’generate_category_bottom’ );
    function generate_category_bottom() { ?>
    testing <?php the_field(‘category_bottom’); ?>
    <?php }

    When using the above text in the Code Snippets plugin, only the text “testing” appears on my category pages. I am happy that it does appear in the correct place, but I am unsure why the advanced custom field will not show?

    I can enter text into the advanced custom field text box on each category page. But the saved text just won’t display. Thanks again in advance for any insight.

  • In order to show values in ACF from a category (term) you must supply the post ID where ACF will find the value.

    See this guide

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.