子比主题 – 给网站增加一个漂亮的网址导航

演示图

子比主题 - 给网站增加一个漂亮的网址导航

演示界面

友情链接 – 一起进步、一起奋斗-编程之旅 (chaosunny.top)

教程引言

如果你希望给自己的网站友链进行分类,那这将是不二之选,本页面将会获取后台链接所设置的链接分类及分类下的网址等各信息,页面外观免费分享给大家

PHP页面代码

将PHP代码放置于主题目录下的Pages文件夹下命名为Nav.php 或者其他名字,只要你能记得住

CSS代码

放置于后台自定义css内

/*导航页*/
.homebk12 .homebk8-ctn li {
    width: calc(20% - 16px)
}

@media (max-width: 799px) {
    .b2-tab-links {
        display:none
    }

    .homebk12 .homebk8-ctn li {
        width: calc(50% - 16px)
    }
}
@media (min-width: 799px) {
    .home-links-right {
        margin-right: 20px;
    }
}
.wrapper {
    margin: 0 auto
}

.b2-radius {
    border-radius: 4px
}

.link-desc {
    display: -webkit-box;
    overflow: hidden;
    box-sizing: border-box;
    margin: 4px 0 8px;
    height: 15px;
    font-size: 13px;
    line-height: 1.3;
    overflow-wrap: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1
}

.dh-box {
    margin-bottom: 20px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -ms-border-radius: 4px
}

.dh-box .tit {
    font-size: 0;
    line-height: 51px
}

.dh-box .tit h2 {
    font-weight: 700;
    font-size: 16px
}

.dh-box .tit h2 {
    display: inline-block;
    vertical-align: middle
}

.b2-tab-links .toc-list {
    margin-right: 0;
    padding: 0;
    border-radius: 0 0 5px 5px;
    text-align: center;
    font-size: 14px
}

.b2-tab-links .toc-list-item {
    margin-bottom: 0
}

.b2-tab-links a.toc-link {
    display: inline-block;
    padding: 5px 10px;
    height: unset;
    border-radius: var(--main-radius);
    background-color: unset;
    line-height: 25px
}

.b2-tab-links .toc-list-item {
    margin-bottom: 5px
}

.mini-submenu {
    position: relative;
    display: block;
    margin-bottom: 5px;
    padding: 11px 20px 11px 15px;
    text-align: center;
    white-space: nowrap;
    font-weight: 700;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer
}

.toc-list-item:hover {
    border-radius: var(--main-radius);
    color: #fff
}

.mini-submenu i {
    display: inline-block;
    margin-right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background-color: #28c687;
    color: #fff;
    vertical-align: top;
    text-align: center;
    font-weight: 400;
    font-size: 12px;
    line-height: 20px
}

i {
    font-style: unset
}

.box:not(.post-3) {
    background: var(--main-bg-color)!important
}

.mb20 {
    margin-bottom: 16px
}

.homebk8-ctn ul {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    flex-wrap: wrap
}

.homebk8-ctn li {
    padding: 20px;
    width: 14.28%;
    border-radius: 5px;
    text-align: center;
    transition: .2s
}

.whitebg-sm {
    border-radius: 8px!important;
    background: #fff
}

.homebk12 .homebk6-btn {
    flex-direction: column
}

.homebk6-btn {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: .2s;
    justify-content: center;
    align-items: center
}

.homebk12 .homebk8-ctn li {
    position: relative;
    overflow: hidden;
    margin-right: 16px;
    margin-bottom: 16px;
    transition: .2s;
    box-shadow: 0 0 10px var(--main-shadow);
}

.homebk12 .homebk8-ctn li:hover .homebk12-item {
}

.homebk12 .homebk8-ctn li:hover .homebk6-btn {
    opacity: 1;
    z-index: 999
}

.homebk12 .homebk6-btn {
    flex-direction: column
}

.homebk12 .homebk8-ctn .homebk6-btn a {
    margin-bottom: 10px;
    height: 28px
}

.homebk12 .homebk8-ctn .homebk6-btn a:hover {
    margin-top: 0;
    opacity: .9
}

.homebk12 .homebk8-ctn li .homebk12-img {
    position: relative;
    overflow: hidden;
    margin-right: auto;
    margin-left: auto;
    padding: 6px;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: #f4f4f4
}

.homebk12 .homebk8-ctn li:hover .homebk12-img {
    opacity: 0
}

.homebk12-img .homebk12-imgbg {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    display: block;
    width: 66px;
    height: 66px;
    background: #eee;
    background-size: cover;
    transform: translate(-50%,-50%)
}

.homebk12 .homebk8-ctn li p {
    overflow: hidden;
    text-align: center
}

.homebk12 .homebk8-ctn .homebk6-btn a {
    margin-bottom: 10px;
    height: 28px
}

.homebk6-btn a.ckxq {
    background: #2dc5ff
}

.homebk6-btn a.zdwz {
    background: #47e193
}

.homebk6-btn a {
    display: block;
    margin: 0 5px;
    width: 80px;
    height: 28px;
    border-radius: 3px;
    background: #999;
    color: #fff;
    text-align: center;
    font-size: 12px;
    line-height: 28px;
    transition: .3s
}

.homebk12 .homebk8-ctn li p {
    overflow: hidden;
    text-align: center
}

.homebk8-ctn li p {
    overflow: hidden;
    color: var(--this-text);
    text-overflow: ellipsis;
    font-size: 12px
}

.homebk8-ctn li h3 {
    overflow: hidden;
    margin-top: 15px;
    margin-bottom: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 15px
}

.homebk8-ctn li:hover h3 {
    opacity: 0
}

.mb20 {
    margin-bottom: 20px
}

.site-warp {
    display: flex;
    overflow: hidden;
    height: 300px;
    align-items: center
}

.site-search h3 {
    margin-bottom: 20px;
    color: #fff;
    text-align: center;
    letter-spacing: .5px;
    font-size: 26px
}

.site-search form {
    position: relative;
    display: flex;
    width: 100%;
    border-radius: 4px 0 0 4px;
    background: #fff
}

.site-search input {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 4px;
    color: var(--this-text);
    text-indent: 10px
}

.site-search button {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: inline-block;
    margin: auto;
    padding: 0;
    width: 80px;
    height: 36px;
    outline: 0;
    border: 0;
    border-radius: 4px;
    background: var(--theme-color);
    color: #fff;
    text-align: center;
    font-size: 14px;
    line-height: 38px;
    cursor: pointer;
    transition: all .1s
}

.search-tmenu {
    margin-bottom: 20px;
    padding: 0;
    text-align: center
}

.search-tmenu li {
    display: inline-block;
    padding: 0 12px
}

.search-tmenu li span {
    display: inline-block;
    padding-bottom: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer
}

.search-tmenu .active span {
    position: relative;
    display: inline-block;
    color: #fff
}

.search-tmenu .active span::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    border-radius: 3px;
    background: #fff;
    content: ''
}

.search-bmenu {
    text-align: center
}

.search-bmenu .on {
    color: #fff;
    opacity: 1
}

.search-item {
    display: inline-block;
    margin: 0 10px;
    color: #fff;
    font-size: 14px;
    opacity: .5;
    cursor: pointer
}

.subnav {
    margin-top: 15px
}

.subnav-item {
    display: none
}

.subnav .active {
    display: block!important
}

.sousk {
    display: flex;
    border: 5px solid rgb(255 255 255 / 18%)
}

.b2-links-yl {
    right: 0;
    padding: 5px;
    border-radius: 0 4px 4px 0;
    background: #fff;
    text-align: center;
    line-height: 26px
}

.b2-tab-links a.toc-link {
    margin: 0
}

.home-links-content {
    display: flex;
    flex-wrap: nowrap
}

.b2-tab-links {
    width: 200px;
    min-width: 200px
}

.btn-outline-dark:not(:disabled):not(.disabled).active,.btn-outline-dark:not(:disabled):not(.disabled):active {
    background-image: linear-gradient(to top,#ef0053 0%,#ef0053 100%);
    color: #fff
}

button {
    border-radius: var(--main-radius)
}

.home-links-right {
    width: 100%;
}

链接提交弹窗PHP代码

由于我们摈弃了友情链接页面采取网址导航页面,所以还是有必要保留前端网址提交,将下方代码放置于functions.php,如果你创建了func.php那就放这个文件里

© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏 分享
评论 共2条

请登录后发表评论