我的网站上有以下代码,它输出“下载”帖子类型的类别列表。我希望排除某些类别出现在输出中,我该怎么做?
<?php
/**
* Generate list of EDD categories to browse
*/
$args = array(
'orderby' => 'name',
'hierarchical' => 1,
'style' => 'none',
'taxonomy' => 'download_category',
'hide_empty' => 0,
'depth' => 1,
'title_li' => '',
// 'parent' => 0
);
$categories = get_categories( $args );
if ( $categories ) {
?>
<div class="search-cats">
<div class="search-cat-text">
<?php _e( 'Browse by category: ', 'checkout' ); ?>
</div>
<nav>
<?php
/**
* Generate list of EDD category links
*/
foreach ( $categories as $category ) {
$link = get_term_link( $category, 'download_category' );
echo '<a href="' . esc_url( $link ) . '" rel="tag">' . $category->name . '</a>';
}
?>
</nav>
</div>
<?php } ?>