Support

Account

Home Forums Front-end Issues Display Category Field in Single Post Page

Unread

Display Category Field in Single Post Page

  • I need to echo custom post category field in the post page
    I use toolset views loop and want to add this shortcode [section_type] to get category icon field value in the post loop or single post page

    function section_type_func() { 
    $current_category = single_cat_title("", false);
    $term_id = get_queried_object_id($current_category);
        echo '<a href="' . get_field('section_icon', 'category_' . $term_id) . '" target="_blank">test </a>';
    
    }
    add_shortcode('section_type', 'section_type_func'); 
Viewing 1 post (of 1 total)

The topic ‘Display Category Field in Single Post Page’ is closed to new replies.