I am using the following to display all the categories from my custom post type. How can I edit it so instead of having the output of the categories in <ul><li>
elements it has <a href ....
instead? I need to edit the output of wp_list_categories( $args );
<?php $customPostTaxonomies = get_object_taxonomies('video');
if(count($customPostTaxonomies) > 0)
{
foreach($customPostTaxonomies as $tax)
{
$args = array(
'orderby' => 'name',
'show_count' => 0,
'pad_counts' => 0,
'hierarchical' => 1,
'taxonomy' => $tax,
'title_li' => ''
);
echo '<span class="tags-button" style="list-style:none; float:left;">';
wp_list_categories( $args );
echo '</span>';
}
} ?>
1 Answer
You will need to use style
parameter to define the type of list. And to remove <br />
tags from the list, set parameter 'echo' => 0
and str_replace to remove <br />
tag from the output.
$args = array(
'orderby' => 'name',
'show_count' => 0,
'pad_counts' => 0,
'hierarchical' => 1,
'taxonomy' => $tax,
'title_li' => '',
'echo' => 0,
'style' => 'simple'
);
echo '<span class="tags-button" style="list-style:none; float:left;">';
echo str_replace( '<br />', '', wp_list_categories( $args ) );
echo '</span>';