Format the generated custom taxonomy HTML

Is there a way to format the generated HTML for custom taxonomy?
I’ve used the following code to generate the taxonomies:

    <?php

    $taxonomy     = 'custom-category';
    $orderby      = 'name'; 
    $show_count   = 0;      // 1 for yes, 0 for no
    $pad_counts   = 0;      // 1 for yes, 0 for no
    $hierarchical = 1;      // 1 for yes, 0 for no
    $title        = '';

    $args = array(
      'taxonomy'     => $taxonomy,
      'orderby'      => $orderby,
      'show_count'   => $show_count,
      'pad_counts'   => $pad_counts,
      'hierarchical' => $hierarchical,
      'title_li'     => $title
    );

    ?>

This generated this unordered list code:

<ul>
    <li class="cat-item cat-item-11">
        <a href="http://localhost/catalog/?custom-category=target-action">Target Action</a>
        <ul class="children">
            <li class="cat-item cat-item-14"><a href="http://localhost/catalog/?custom-category=enhance-user-experience">Enhance user experience</a></li>
            <li class="cat-item cat-item-13"><a href="http://localhost/catalog/?custom-category=improve-conversion-rate">Improve conversion rate</a></li>
        </ul>
    </li>
    <li class="cat-item cat-item-12">
        <a href="http://localhost/catalog/?custom-category=target-sites">Target Sites</a>
        <ul class="children">
            <li class="cat-item cat-item-15"><a href="http://localhost/catalog/?custom-category=show-media-content">Show media content</a></li>
        </ul>
    </li>
</ul>

I need something like this. Div around parent tags and checkboxes instead of links:

<ul>
    <li class="cat-item cat-item-11">
        <div class="parent">Target Action</div>
        <ul class="children">
            <li class="cat-item cat-item-14"><input type="checkbox" ng-click="includeTag('Enhance user experience')"/>Enhance user experience</li>
            <li class="cat-item cat-item-13"><input type="checkbox" ng-click="includeTag('Improve conversion rate')"/>Improve conversion rate</li>
        </ul>
    </li>
    <li class="cat-item cat-item-12">
        <div class="parent">Target Sites</div>
        <ul class="children">
            <li class="cat-item cat-item-15"><input type="checkbox" ng-click="includeTag('Show media content')"/>Show media content</li>
        </ul>
    </li>
</ul>


Source: wordpress

Leave a Reply