Support

Account

Home Forums Front-end Issues display the extra category description

Helping

display the extra category description

  • Hello,

    I am new here, and also very new to php and wp. First of all, thanks for a wonderful plugin so I could add custom field to my posts.

    I tried also to add an extra description field to my categories. The difficult side here for me is to display it in a category template.

    My field name is “my_cat_desc”. And I tried to put in category.php template:

    php the_field('my_cat_desc', get_query_var('cat'));

    But nothing shows up ( I could put sth in the field on category admin page).

    Could you please help me?

  • Please see: http://www.advancedcustomfields.com/resources/functions/the_field/

    You need to construct the correct $id value to get your field, which is a combo of the taxonomy slug and the term id.

    
    $id = 'category_'.get_queried_object()->term_id;
    the_field('my_cat_desc', $id);
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘display the extra category description’ is closed to new replies.