WordPress获取全站分类名称和url
<?php // 获取全站分类名称和url(分类中必须含有文章,否则不显示) $args=array( 'orderby' => 'ID', 'exclude'=> '1', //排除的分类ID,以英文逗号分隔开 'order' => 'ASC', 'taxonomy' => 'info_list' // 分类法 ); $categories=get_categories($args); foreach($categories as $category){ echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>'; } ?>