我有以下的在我的WordPress的模板,我想改變它的碼位,所以它只顯示頂級類別,而不是所有類別:顯示頂級的wordpress類別
<?php
/**
* Generate list of EDD categories to browse
*/
if ($categories) { ?>
<div class="search-cats">
<div class="search-cat-text">
<?php _e('Or 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 } ?>
燦誰來幫幫我?
謝謝,完美的作品。 – Teege