登录  /  注册
博主信息
博文 49
粉丝 0
评论 0
访问量 47633
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
wordpress 分类栏目 和link 友情链接标签调用
lus菜
原创
131人浏览过

分类栏目

  1. <li class="signup menu-item menu-item-type-custom menu-item-object-custom"><a href="/">Home</a></li>
  1. <a href="/" class="uk-logo uk-navbar-item">
  2. <img loading="eager" width="200" height="48" src="[logo]">
  3. </a>
  1. <ul class="uk-navbar-nav">
  2. <?php
  3. $terms = get_terms('category', 'orderby=name&hide_empty=0');
  4. $count = count($terms);
  5. if ($count > 0) {
  6. foreach ($terms as $key => $term) {
  7. // 循环输出前 6 个分类
  8. if ($key <= 5) {
  9. ?>
  10. <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-home">
  11. <!-- CSS 控制分类名称的显示样式,使得文本不会溢出,超长文本会显示省略号。 -->
  12. <a style="cursor: pointer;display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px;"
  13. href="<?php echo esc_url(get_term_link($term, $term->slug)); ?>"><?php echo esc_html($term->name); ?></a>
  14. </li>
  15. <?php
  16. }
  17. }
  18. }
  19. ?>
  20. </ul>
  1. <h4 class="uk-h4"> LINK: </h4>
  2. <?php
  3. $links = get_bookmarks(array(
  4. 'orderby' => 'name',
  5. 'order' => 'ASC',
  6. ));
  7. if ($links) {
  8. echo '<ul class="uk-list">';
  9. foreach ($links as $link) {
  10. 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%;"
  11. 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>';
  12. }
  13. echo '</ul>';
  14. }
  15. ?>

在functions.php 里加上这条代码

  1. // 友情链接
  2. add_filter( 'pre_option_link_manager_enabled', '__return_true' );

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学