Support

Account

Home Forums General Issues Add image as background-image inline style Reply To: Add image as background-image inline style

  • The value of $post_id depends on what version of ACF you are using.

    In ACF 4 or < 5.5.0

    
    $image = get_field('cck_menu_category_image', $category->taxonomy.'_'.$category->term_id );
    

    In ACF >= 5.5.0 you can use the above or you can use

    
    $image = get_field('cck_menu_category_image', 'term_'.$category->term_id );
    

    I think that you might also be able to use (but I’m not sure)

    
    $image = get_field('cck_menu_category_image', $category);