hide_empty
隐藏没有附加贴子的术语。你有一页没有ht_kb_tags
如果我理解正确的话,请附上。
自从get_the_terms()
退货false
如果没有条款,您应该能够防止foreach()
使用if()
声明:
$mget_site_url = get_site_url();
//This gets me all the correct terms...
$mget_the_terms = get_the_terms(get_queried_object_id(), \'ht_kb_tag\');
if ( ! empty( $mget_the_terms ) ) {
echo __( \'Tagged: \', \'knowall\' );
foreach ($mget_the_terms as $keygroup => $valuegroup) {
foreach ($valuegroup as $key => $value) {
if (($key == \'name\') && ($value != \'layout-wide\')) {
//link the terms
echo "<a href=\'{$mget_site_url}/tags/{$value}\' rel=\'tag\'>{$value}</a>";
}
}
}
}