格式化生成的自定义分类法HTML

时间:2015-05-19 08:44:02

标签: wordpress wordpress-theming

有没有办法为自定义分类法格式化生成的HTML? 我使用以下代码生成分类法:

    <?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
    );

    ?>
    <ul>
       <?php wp_list_categories( $args ); ?>
    </ul>

这生成了这个无序列表代码:

<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>

我需要这样的东西。除了父标签和复选框而不是链接:

<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>

0 个答案:

没有答案