Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/262.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用WordPress中的_term_list()在列表中显示自定义分类法_Php_Wordpress_Wordpress Theming - Fatal编程技术网

Php 使用WordPress中的_term_list()在列表中显示自定义分类法

Php 使用WordPress中的_term_list()在列表中显示自定义分类法,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我需要使用_term_list()在ul中显示自定义分类的帮助 我可以让它列出我想要的所有术语,但我需要一个无序的列表,而不仅仅是一个由注释分隔的链接列表 以下是我必须处理的问题: <?php echo get_the_term_list($post->ID, 'skills', '<h5>Project Role</h5> ', ', ', '', ); ?> 以下是WordPress函数参考,如果您需要它:这将使您的自定义分类显示在无序列表中,

我需要使用_term_list()在ul中显示自定义分类的帮助

我可以让它列出我想要的所有术语,但我需要一个无序的列表,而不仅仅是一个由注释分隔的链接列表

以下是我必须处理的问题:

<?php echo get_the_term_list($post->ID, 'skills', '<h5>Project Role</h5> ', ', ', '', ); ?>


以下是WordPress函数参考,如果您需要它:

这将使您的自定义分类显示在无序列表中,并将h5标题置于顶部:

<?php echo get_the_term_list( $post->ID, 'skills', '<h5>Project Role</h5><ul><li>', '</li><li>', '</li></ul>' ); ?>

//使用此代码
//    Use this code
    <?php
    $taxonomy     = 'product-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        = '';
    $empty        = 1;      // 1 for yes, 0 for no

    $args = array(
        'taxonomy'=> $taxonomy, 'orderby' => $orderby,  'show_count' => $show_count, 'pad_counts'   => $pad_counts, 'hierarchical' => $hierarchical,
        'title_li'     => $title, 'hide_empty'   => $empty ); ?>
        <ul class="sidebar_cat" data-role="listview"> <?php $variable = wp_list_categories( $args ); $variable = str_replace(array('(',')'), '', $variable);    $variable = str_replace('(', '<span class="ui-li-count">', $variable);
        $variable = str_replace(')', '</span>', $variable);   echo $variable; ?>
        </ul>