How can I use separator with wp_list_categories using inline list? In documentation they say (string) Separator between links. Default '<br />'.
Well I guess that means I could use HTML right? I was thinking about using ·
to connect items like I have in image but nothing happens.
wp_list_categories(array(
'title_li' => '',
'child_of' => get_cat_ID('mycatname'),
'hide_empty' => true,
'show_option_none' => false,
'separator' => '·'
));
I tried putting something else as separator, but nothing happens so I wonder if it even works or am I missing something?
<ul>
<?php
$arr = wp_list_categories(array(
'title_li' => '',
'child_of' => get_cat_ID('Biljke'),
'hide_empty' => true,
'show_option_none' => false,
'separator' => '-----',
));
?>
</ul>
1 Answer
It looks like the default of the style
input parameter is list
.
Try something like:
'separator' => '·',
'style' => 'separator', // something else than 'list'
to override the list
default.
We can see why this happens by peeking into the Walker_Category::start_el()
method. There we have the following:
if ( 'list' == $args['style'] ) {
// ...cut ...
} elseif ( isset( $args['separator'] ) ) {
$output .= "\t$link" . $args['separator'] . "\n";
} else {
$output .= "\t$link<br />\n";
}