WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
[resolved] How to show custom category field on a post (6 posts)

  1. jana26
    Member
    Posted 1 year ago #

    Hi,

    i'm trying to show category custom fields, that i created with the plugin, on the posts of this category.
    I created a group, choosed taxonomy is equal to categories under location, created a text field named details and saved it.
    Under Categories i find now the textfield.
    I entered a value in it, but when i'm trying to show the value in the posts of the categorie it doesn't show up. I tried with the_field('details'); but nothing was shown.
    Can anyone please help me?

    Cheers.

    http://wordpress.org/extend/plugins/advanced-custom-fields/

  2. elliotcondon
    Member
    Plugin Author

    Posted 1 year ago #

    Jo jana26,

    You will need to target the category with the post_id parameter. Please read this doc:
    http://www.advancedcustomfields.com/docs/tutorials/retrieving-values-from-other-pages-taxonomy-user-media/

    Good luck!

  3. jana26
    Member
    Posted 1 year ago #

    Hey,

    thanks for the reply.
    I tried to make it like this:

    <?php $category = get_the_category();
    $value = get_field('details', 'category_'. $category->cat_ID .''); ?>

    but it didn't work.
    Any idea?

  4. jana26
    Member
    Posted 1 year ago #

    Found a solution.

    <?php $details = get_field('details', 'category_'. the_category_ID( $echo ) .'');
    $echo $details;?>

    Thank you very much for your support.

  5. mister_r
    Member
    Posted 1 year ago #

    Thank you, jana26.

  6. binnovate
    Member
    Posted 12 months ago #

    I came out with a new way:
    <?php echo get_option('home'); ?>/?cat=<?php the_field('home_left_column-first_row_link'); ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.