B2主题首页添加注册会员用户与付费会员展示

B2主题首页添加注册会员用户与付费会员展示

教程如下

第一步

在你的首页模块添加以下代码

<div  class="  home_row home_row_1  module-qukuai  " style="background-color:;"> 
<div class="wrapper">
<div class="home-row-left content-area box b2-radius"> 
 <div class="hot-top wrapper layui-clear">
<span class="note"> 花 粉 </span>
<i class="tg-ph"></i>
<div class="left">
<a class="hover" id="lively_online" onmouseenter=lively_online()>最新注册</a>
<a class="" id="contribution" onmouseenter=contribution()>付费用户</a>
</div>
<div class="right">
<div class="right-overflow" id="yhturns" style="transform: translateY(0px);">
<div class="right-main">
<ul class="layui-clear top-ul">
<?php $usernames = $wpdb->get_results("SELECT ID,display_name, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 8");
foreach ($usernames as $username) {
    echo '<li>
    <a href="'.esc_html(get_home_url().'/users/'.$username->ID).'" rel="external nofollow" >
    <div class="list-img">
    <img src="'.get_avatar_url($username->ID).'" class="yuan">
    </div>
    <h3>
    ' . $username->display_name .'
    </h3>
    </a>
    </li>
    ';
    }
    ?>
</ul>
</div>
<div class="right-main">
<ul class="layui-clear top-ul">
<?php $usernames = $wpdb->get_results("SELECT user_id FROM $wpdb->usermeta where meta_key='zrz_vip' and meta_value='vip0' or meta_key='zrz_vip' and meta_value='vip1' or meta_key='zrz_vip'  and meta_value='vip2' or meta_key='zrz_vip' and meta_value='vip3' order by user_id desc limit 8");
foreach ($usernames as $username) {
    $userinfo = get_userdata($username->user_id);
    echo '<li>
    <a href="'.esc_html(get_home_url().'/users/'.$username->user_id).'" rel="external nofollow" >
    <div class="list-img">
    <img src="'.get_avatar_url($username->user_id).'" class="yuan">
    </div>
    <h3>
    ' .$userinfo->display_name.'
    </h3>
    </a>
    </li>
    ';
    }
    ?>
</ul>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function lively_online() {
    document.getElementById('lively_online').className = 'hover';
    document.getElementById('contribution').className = ' ';
    document.getElementById('yhturns').style = 'transform: translateY(0px);';
    }
function contribution() {
    document.getElementById('lively_online').className = ' ';
    document.getElementById('contribution').className = 'hover';
    document.getElementById('yhturns').style = 'transform: translateY(-160px);';
    }
</script>
</div></div></div>

第二步

在你的自定义CSS中添加以下样式代码

/**用户排行榜开始*/.hot-top .left {
    float: left;
}
.hot-top .right .top-ul li a h3 {
    white-space: nowrap;
}
.hot-top .right {
    float: right;
}
img {
    border: none;
}
 
.hot-top {
    width: 1500px;
    margin-bottom: 25px;
    padding: 22px 20px;
    position: relative;
    height: 147px;
    overflow: hidden;
    border-radius: 10px 10px 10px 10px;
}
.hot-top .tg-ph {
    background-size: 100% 100%;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 2;
    display: block;
    width: 60px;
    height: 60px;
}
.hot-top .left {
    height: 100%;
}
.hot-top .left a {
    display: block;
    width: 121px;
    height: 45px;
    line-height: 45px;
    background: #f6f6f6;
    text-align: center;
    font-size: 15px;
    color: #989898;
    margin-bottom: 13px;
    cursor: pointer;
    border-radius: 10px;
}
.hot-top .left a:last-child {
    margin-bottom: 0;
}
.hot-top .left .hover {
    background: var(--b2color);
    color: #FFF;
    position: relative;
}
.hot-top .left .hover:after {
    content: "";
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left: 10px solid var(--b2color);
    position: absolute;
    top: 15.5px;
    right: -10px;
    z-index: 1;
}
.hot-top .right-main {
    height: 100%;
    overflow-y: auto;
    margin-bottom: 30px;
}
.hot-top .right-main:last-child {
    margin-bottom: 0px;
}
.hot-top .right-overflow {
    transition: 0.4s all;
    transform: translateY(0);
}
.hot-top .right {
    float: left;
    width: calc( 100% - 147px);
    margin-left: 26px;
    height: 100%;
}
.hot-top .right .top-ul {
    height: 130px;
    overflow: hidden;
}
.hot-top .right .top-ul li {
    width: 78px;
    float: center;
    margin:0px 20px;
    display:inline-block;
}
.hot-top .right .top-ul li:nth-child(10n) {
    margin-right: 0;
}
.hot-top .right .top-ul li a {
    display: block;
}
 
.hot-top .right .top-ul li a .list-img {
    width: 100%;
    height: 78px;
    line-height: 38px;
    text-align: center;
    border-radius: 10px;
}
.hot-top .right .top-ul li a .list-img img {
    width: 100%;
}
.hot-top .right .top-ul li a .list-img img:hover {
    opacity: 0.8;
}
.hot-top .right .top-ul li a h3 {
    margin-top: 7px;
    font-size: 13px;
    line-height: 25px;
    height: 25px;
    overflow: hidden;
    width: 100%;
    text-align: center;
}
.new-position {
    height: 780px;
}
.new-position .left {
    height: 100%;
    width: calc( ( 100% - 13px ) * 0.36 );
}
.new-position .right {
    width: calc( ( 100% - 13px ) * 0.64 );
    height: 100%;
    background: #FFF;
    padding: 17px 28px;
}
.new-position .layui-carousel > [carousel-item] > * {
    background: #FFF;
}
.new-position #index-lb {
    height: 300px;
}
.new-position #index-lb div div img {
    width: 100%;
    min-height: 100%;
}
.new-position .index-login {
    background: #FFF;
    margin-top: 13px;
    height: calc( 767px - 300px);
    padding: 25px 33px;
    position: relative;
}
span.note {
    position: absolute;
    top: 10px;
    right: -50px;
    z-index: 1;
    width: 140px;
    height: 20px;
    background: var(--b2color);
    color: #fff;
    line-height: 20px;
    -webkit-transform: rotate(45deg);
    transform: rotate(45deg);
    text-align: center;
    font-size: 12px;
}
img.rela {
    position: absolute;
    left: 52px;
    z-index: 2;
    /* right: 50px; */    top: 58px;
    height: 25px;
    width: 25px;
}
/*头像呼吸光环和鼠标悬停旋转放大开始*/img.yuan {
    border-radius: 50%;
    animation: light 4s ease-in-out infinite;
    transition: 2s;
}
img.yuan:hover {
    transform: scale(1) rotate(720deg);
}
}
/*头像呼吸光环和鼠标悬停旋转放大结束*//**用户排行榜结束*/

最后放好了之后,刷新一下浏览器的缓存查看效果即可!!!

重要提示

如有解压密码: 看下载页、看下载页、看下载页。
源码工具资源类具有可复制性: 建议具有一定思考和动手能力的用户购买。
请谨慎考虑: 小白用户和缺乏思考动手能力者不建议赞助。
虚拟商品购买须知: 虚拟类商品,一经购买打赏赞助,不支持退款。请谅解,谢谢合作!

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容