Breaking Categories Up into Individual Divs

You can customize the way wp_list_categories() render the categories by using a custom Walker and pass it as an argument of the function :


$args = array(
    'show_option_none'    => __( 'No treatment categories' ),
    'taxonomy'            => 'treatment-categories',
    'title_li'            => __( 'Treatment Categories' )
    'title_li'            =>  '',
    'walker'              => new My_Walker_Category()
);
if ( count( get_categories( $args ) ) ) {
    wp_list_categories( $args );
}

Where My_Walker_Category() extends Walker_Category class.

The class contains only 3 methods that you need to overwrite to suits your needs.

For exemple in start_lvl and end_lvl methods, you have a test relative to $args['style']:


if ( 'list' != $args['style'] )
    return;

This is relative to the ‘style’ args or wp_list_categories :

‘style’ (string)

The style used to display the categories list. If
‘list’, categories will be output as an unordered list. If left empty
or another value, categories will be output separated by
tags.
Default ‘list’.

So you can add a custom style (‘div’ for exemple) in you My_Walker_Category() and customize the render of the elements according to your needs.