<li class="signup menu-item menu-item-type-custom menu-item-object-custom"><a href="/">Home</a></li>
<a href="/" class="uk-logo uk-navbar-item">
<img loading="eager" width="200" height="48" src="[logo]">
</a>
<ul class="uk-navbar-nav">
<?php
$terms = get_terms('category', 'orderby=name&hide_empty=0');
$count = count($terms);
if ($count > 0) {
foreach ($terms as $key => $term) {
// 循环输出前 6 个分类
if ($key <= 5) {
?>
<li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home">
<!-- CSS 控制分类名称的显示样式,使得文本不会溢出,超长文本会显示省略号。 -->
<a style="cursor: pointer;display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px;"
href="<?php echo esc_url(get_term_link($term, $term->slug)); ?>"><?php echo esc_html($term->name); ?></a>
</li>
<?php
}
}
}
?>
</ul>
<h4 class="uk-h4"> LINK: </h4>
<?php
$links = get_bookmarks(array(
'orderby' => 'name',
'order' => 'ASC',
));
if ($links) {
echo '<ul class="uk-list">';
foreach ($links as $link) {
echo '<li class="el-item"><div class="el-content uk-panel"><a style="cursor: pointer;display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80%;"
class="el-link uk-link-text uk-margin-remove-last-child" href="' . esc_url($link->link_url) . '" title="' . esc_attr($link->link_description) . '">' . esc_html($link->link_name) . '</a></div></li>';
}
echo '</ul>';
}
?>
// 友情链接
add_filter( 'pre_option_link_manager_enabled', '__return_true' );
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号