WordPress.org

Forums

Advanced Custom Fields
How Do I Show CATEGORY Custom Fields? (3 posts)

  1. Justin Case
    Member
    Posted 11 months ago #

    How do I show a custom field for a Category??? (Please don't say "read the docs," I have been reading them for three hours now!!!)

    I want to show a different block of text on each Category page.

    I created a text area custom field for my Categories. The field name is:

    category_footer

    Now how do I actually display that "category_footer" custom field on the Category pages?

    I have tried using short codes:

    [acf field="category_footer"]

    And that did not work. So I tried using PHP:

    <p><?php the_field('category_footer'); ?></p>

    But that did not work either.

    The data exists in the BACKEND ok. By that, I mean that if i go to a category page and enter text into the "category_footer" custom footer, then that data will stay there.

    But I have no idea how to access that data on the front end.

    What code should I use and WHERE does it need to go???

    By the way; I have the location rules for my "category_footer" custom field set as the following:

    Show this field group if Taxonomy Term is equal to Categories

    I don't use tags / taxonimies of any kind (at least as far as I know).

    Also, I am using genesis framework and have been trying to use the shortcodes and php in the genesis simple hooks areas.

    Thanks in advance.

    https://wordpress.org/plugins/advanced-custom-fields/

  2. sblanchon
    Member
    Posted 10 months ago #

    I have the same problem, thanks in advance too for your reply !

  3. sblanchon
    Member
    Posted 10 months ago #

    I found the solution on the support :
    $queried_object = get_queried_object();
    $taxonomy = $queried_object->taxonomy;
    $term_id = $queried_object->term_id;
    $couleur = get_field('yourcustomfield', $taxonomy . '_' . $term_id);?>

Reply

You must log in to post.

About this Plugin

  • Advanced Custom Fields
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic