详情 评论 问答 子比主题美化 – 仿极主题首页人气作者小柚子12月1日更新关注私信05515 自动调用已经发布过文章的用户,按文章总浏览量即人气值从多到少排序。电脑端默认显示7位作者,手机端默认显示3位作者。兼容手机端和黑夜模式。 教程 该代码请上传到主题index.php的合适位置 <div id="jitheme_home_13_hotuser"> <div id="Onecad-tuijian" class="tuc-2ea177b2-28c195-0 home_row module-posts tuc-2ea177b2-28c195-0"> <div id="user-list" class="tuc-2ea177b2-28c195-0 home-authors authors_jitheme tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 container tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 box-body notop tuc-2ea177b2-28c195-0"><div class="tuc-2ea177b2-28c195-0 title-theme tuc-2ea177b2-28c195-0">热门作者专栏<small class="tuc-2ea177b2-28c195-0 ml10 tuc-2ea177b2-28c195-0">发挥更具影响力的创作</small></div></div> <div class="tuc-2ea177b2-28c195-0 part-content tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 items author-items tuc-2ea177b2-28c195-0"> <?php $allusers=get_users([ 'has_published_posts' => ['post'] ,//post 文章类型,还可以追加 page 以及自定义文章类型 'exclude' => array(3) ]); $newArrays=array(); foreach ($allusers as $alluser){ $newArraya = array('name'=> $alluser->display_name,'renqi'=> get_user_posts_meta_count($alluser->ID, 'views'),'userid'=>$alluser->ID); array_push($newArrays,$newArraya); } function compareAge($a, $b){ if ($a['renqi'] == $b['renqi']) { return 0; } elseif ($a['renqi'] < $b['renqi']) { return 1; } else { return -1; } } usort($newArrays, "compareAge"); // 调用 usort() 函数进行排序 $count = 0; foreach ($newArrays as $newArray){ ?> <div id="item-author" class="tuc-2ea177b2-28c195-0 item item-author tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 item-wrap box b2-radius tuc-2ea177b2-28c195-0" style="background:#fff;height:100%"> <div class="tuc-2ea177b2-28c195-0 item-bg tuc-2ea177b2-28c195-0"> <i class="tuc-2ea177b2-28c195-0 thumb jitheme_jb_<?php echo $count; ?> tuc-2ea177b2-28c195-0"></i> </div> <div class="tuc-2ea177b2-28c195-0 item-top b2-radius tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 author-avatar tuc-2ea177b2-28c195-0"> <?php echo zib_get_data_avatar($newArray['userid']);?><?php echo zib_get_avatar_badge($newArray['userid']); ?> </div> <div class="tuc-2ea177b2-28c195-0 author-main tuc-2ea177b2-28c195-0"> <p class="tuc-2ea177b2-28c195-0 author-name tuc-2ea177b2-28c195-0"> <?php echo zib_get_user_name('id='.$newArray['userid'].'&class=flex1 flex ac&follow=true'); ?> </p> <p class="tuc-2ea177b2-28c195-0 author-meta tuc-2ea177b2-28c195-0"> <span> 影响力 <?php echo $newArray['renqi']; ?></span> <span> 文章数 <?php echo (int) count_user_posts($newArray['userid'], 'post', true); ?></span> </p> </div> <div class="tuc-2ea177b2-28c195-0 author-info tuc-2ea177b2-28c195-0"> <p> <i class="tuc-2ea177b2-28c195-0 b2font b2-file-list-2-line tuc-2ea177b2-28c195-0"></i>个性签名:<?php echo get_user_desc($newArray['userid']); ?></p> </div> <div class="tuc-2ea177b2-28c195-0 author-info tuc-2ea177b2-28c195-0"> <p> <i class="tuc-2ea177b2-28c195-0 ico icon-article tuc-2ea177b2-28c195-0"></i>个性签名:<?php echo get_user_desc($newArray['userid']); ?></p> </div> <div class="tuc-2ea177b2-28c195-0 author-btn tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 looo tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 user-s-follow jitheme-button tuc-2ea177b2-28c195-0"> <?php echo zib_get_author_header_btns($newArray['userid']); ?> </div> </div> </div> </div> <div class="tuc-2ea177b2-28c195-0 item-bottom tuc-2ea177b2-28c195-0"> <h3 class="tuc-2ea177b2-28c195-0 item-bottom-title tuc-2ea177b2-28c195-0">最近更新</h3> <div class="tuc-2ea177b2-28c195-0 item-bottom-cont tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 items tuc-2ea177b2-28c195-0"> <?php $lzj=new WP_Query(array( 'posts_per_page' =>2, //每页返回2个 'post_type' => 'post', 'post_status'=>'publish', 'author'=>$newArray['userid'], 'orderby' => 'views', )); while ($lzj->have_posts()) :$lzj->the_post(); $category = get_the_category($post->id); ?> <div class="tuc-2ea177b2-28c195-0 ap-item tuc-2ea177b2-28c195-0"> <a href="<?php esc_url(the_permalink()); ?>" target="_blank" class="tuc-2ea177b2-28c195-0 ap-item-wrap has-thumb tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 ap-item-thumb b2-radius tuc-2ea177b2-28c195-0"> <?php echo zib_post_thumbnail(); ?> </div> <div class="tuc-2ea177b2-28c195-0 ap-item-main tuc-2ea177b2-28c195-0"> <h3 class="tuc-2ea177b2-28c195-0 ap-item-title tuc-2ea177b2-28c195-0"><?php the_title(); ?></h3> <h4 class="tuc-2ea177b2-28c195-0 ap-item-meta tuc-2ea177b2-28c195-0"><div class="tuc-2ea177b2-28c195-0 jitheme_cat tuc-2ea177b2-28c195-0"><div class="tuc-2ea177b2-28c195-0 post-list-cat tuc-2ea177b2-28c195-0"><?php echo $category [0]->cat_name;?></div></div></h4> </div> </a> </div> <?php endwhile; ?> </div> </div> </div> </div> </div> <?php if (++$count > 6) { break; // 达到指定数量后跳出循环 } } ?> <div id="item-tobe-author" class="tuc-2ea177b2-28c195-0 item item-tobe-author item-author tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 item-wrap box b2-radius tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 item-wrapb b2-radius tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 item-bg tuc-2ea177b2-28c195-0"> <i class="tuc-2ea177b2-28c195-0 thumb jitheme_jb_7 tuc-2ea177b2-28c195-0"></i> </div> <div class="tuc-2ea177b2-28c195-0 tobe-author-wrap tuc-2ea177b2-28c195-0"> <div class="tuc-2ea177b2-28c195-0 tobe-author b2-radius tuc-2ea177b2-28c195-0"> <h2 class="tuc-2ea177b2-28c195-0 item-title tuc-2ea177b2-28c195-0"> <i class="tuc-2ea177b2-28c195-0 ico icon-zuozhe tuc-2ea177b2-28c195-0"></i><?php echo get_bloginfo('name'); ?></h2> <div class="tuc-2ea177b2-28c195-0 item-cont tuc-2ea177b2-28c195-0"> <p>利用优知新庞大的曝光矩阵,全方位提升你的个人影响力,获得更多创作分成和粉丝群体。</p> <h4 class="tuc-2ea177b2-28c195-0 lw-item-meta tuc-2ea177b2-28c195-0"> <span class="tuc-2ea177b2-28c195-0 meta-item meta-avatars tuc-2ea177b2-28c195-0"> <?php $count2 = 0;foreach ($newArrays as $newArray){ if ($count2 < 5) { // 判断计数器小于3时才输出 echo zib_get_data_avatar($newArray['userid']) ; $count2++; // 每次输出后将计数器加1 } else { break; // 达到指定数量后跳出循环 } } ?> </span> <span class="tuc-2ea177b2-28c195-0 meta-item meta-views tuc-2ea177b2-28c195-0">人气作者</span></h4> <h3 class="tuc-2ea177b2-28c195-0 count tuc-2ea177b2-28c195-0"> <strong><?php echo count($allusers); ?></strong> <span>位作者加入</span></h3> </div> <div class="tuc-2ea177b2-28c195-0 item-btns tuc-2ea177b2-28c195-0"> <a href="/contribution" class="tuc-2ea177b2-28c195-0 listygo-btn listygo-btn-bj listygo-btn--style1 b2-radius tuc-2ea177b2-28c195-0"> <span class="tuc-2ea177b2-28c195-0 listygo-btn__icon tuc-2ea177b2-28c195-0"> <i class="tuc-2ea177b2-28c195-0 fa fa-fw fa-pencil-square-o tuc-2ea177b2-28c195-0"></i> </span> <span class="tuc-2ea177b2-28c195-0 listygo-btn__text tuc-2ea177b2-28c195-0">我要投稿</span></a> <a href="/user" class="tuc-2ea177b2-28c195-0 listygo-btn listygo-btn-wbj listygo-btn--style1 b2-radius tuc-2ea177b2-28c195-0"> <span class="tuc-2ea177b2-28c195-0 listygo-btn__icon tuc-2ea177b2-28c195-0"> <i class="tuc-2ea177b2-28c195-0 fa fa-calendar-check-o tuc-2ea177b2-28c195-0"></i> </span> <span class="tuc-2ea177b2-28c195-0 listygo-btn__text tuc-2ea177b2-28c195-0">用户中心</span></a> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> 主题配置-自定义CSS加入代码: /*仿极主题首页人气作者开始*/ .item-author .author-avatar .avatar { box-sizing: border-box; padding-top: 0; border: .3rem solid #ff0000; border-radius: 100%; overflow: hidden; } .item-author .author-avatar:after { content: '创'; display: block; position: absolute; left: 50%; bottom: 97%; margin-left: -25%; width: 50%; height: 33.3333%; background-image: url(https://zy.nuoyo.cn/pic/uisdc_n2.png); background-position: center; background-repeat: no-repeat; -webkit-background-size: contain; background-size: contain; color: #ffffff; font-size: 12px; line-height: 2.25em; text-align: center; -webkit-transform: scale(.8); -ms-transform: scale(.8); transform: scale(.8); -webkit-transform-origin: center bottom; -ms-transform-origin: center bottom; transform-origin: center bottom; } .author-main{ padding-left:70px; } .author-name .focus-color{ display:none!important; } .looo .msg-icon,.looo .top{ display:none; } .home-authors .item-tobe-author .item-cont .count { margin-bottom: 15px; } .home-authors .item-tobe-author .item-cont .count strong { font-size: 35px; color: #fe2c55; font-weight: bold; } .home-authors .item-tobe-author .item-cont .count span { font-size: 15px; font-weight: normal; } .home-authors .item-tobe-author .item-btns { font-size: 14px; text-align: center; display: flex; color: #fff; } .listygo-btn { margin-left:5px; } .listygo-btn__icon { min-width: 40px; min-height: 40px; display: inline-grid; place-content: center; border-radius: 40px; position: relative; z-index: 1; } .listygo-btn-wbj { color: #fe2c55; border: 1px solid #fe2c55; background-color: #fff; } .listygo-btn--style1:hover::before { left: 0; width: 100%; opacity: 1; visibility: visible; transition: width 0.8s ease } .listygo-btn--style1::before { position: absolute; content: ""; left: 100%; width: 0%; height: 100%; background-color: #fe2c55; opacity: 0; visibility: hidden; z-index: -1 } .listygo-btn--style1:hover .listygo-btn__icon::before { transform: scale(1) rotate(180deg) } .listygo-btn--style1:hover .listygo-btn__icon i,.listygo-btn--style1:hover span { transition: all 0.4s ease; color: #fff } .listygo-btn__icon i { z-index: 1; font-size: 20px; transform: rotate(0deg); } .listygo-btn-bj { color: #fff; border: 0; background-color: #fe2c55; } .listygo-btn { overflow: hidden; outline: 0; box-shadow: none; font-size: 15px; line-height: 1.2; font-weight: 600; width: 100%; transition: all 0.4s ease; -webkit-transition: all 0.4s ease; -moz-transition: all 0.4s ease; -ms-transition: all 0.4s ease; padding: 0; display: inline-flex; align-items: center; position: relative; text-align: center; z-index: 1; } .home-authors .item-tobe-author .item-title { color: #fe2c55; font-size: 28px; margin-bottom: 10px; font-weight: bold; } .home-authors .item-tobe-author .item-cont { font-size: 15px; color: #b5b5b5; height: auto; line-height: 30px; } .home-authors .item-tobe-author .lw-item-meta { font-weight: normal; font-size: 12px; position: relative; line-height: 24px; color: #8f8f8f; margin: 20px 0px; } .home-authors .item-tobe-author .meta-avatars { display: inline-block; vertical-align: middle; margin-right: 5px; margin-left: 5px; } .home-authors .item-tobe-author .meta-avatars img { display: inline-block; width: 30px; -webkit-border-radius: 100%; -moz-border-radius: 100%; border-radius: 100%; overflow: hidden; margin-left: -10px; border-radius: 50%; transform: translateX(0px); overflow: hidden; border: 3px solid #fff; } .home-authors .author-items { margin-bottom:20px; display: flex; flex-wrap: wrap; } .home-authors .item, .home-authors .group-item .item-images .img-item { padding:5px 5px; width:25%; } .item-author .item-wrap, .home-authors .item-wrap { background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%); overflow: hidden; position: relative; -webkit-transition: all .2s; transition: all .2s; } .item-author .item-bg { position: absolute; left: 0; right: 0; top: 0; padding-top: 35%; overflow: hidden; } .item-author .item-bg::before { content: ''; display: block; position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; } .home-authors .item-tobe-author .tobe-author { background: #fff; height: calc(100% - 20px); box-sizing: border-box; position: relative; } .item-author .item-bg .thumb { padding-top: 50%; position: absolute; left: -31.25px; right: -31.25px; top: -31.25px; width: auto; } .jitheme_jb_1 { background-image: linear-gradient(to top, #4481eb 0%, #04befe 100%); } .jitheme_jb_2 { background-image: linear-gradient(to top, #0819ff 0%, #ff99f2b5 100%); } .jitheme_jb_3 { background-image: linear-gradient(to right, #dedde6, #e5d2df); } .jitheme_jb_4 { background-image: linear-gradient(to right, #ede1d2, #e1dfda); } .jitheme_jb_5 { background-image: linear-gradient(to right, #d9d7d2, #c7b6b1); } .jitheme_jb_6 { background-image: linear-gradient(to right, #e4e1db, #c9d4d4); } .jitheme_jb_7 { background-image: linear-gradient(to top, #ff0844 0%, #ffb199 100%); } .jitheme_jb_8 { background-image: linear-gradient(-60deg, #ff5858 0%, #f09819 100%); } .jitheme_jb_0 { background-image: linear-gradient(180deg, #2af598 0%, #009efd 100%); } .item-author .item-bg::after { content: ''; display: block; position: absolute; left: 0; right: 0; bottom: 0%; padding-top: 11%; background-image: -webkit-linear-gradient(top,rgba(255,255,255,0.7) 0%,#fff 70%); background-image: linear-gradient(180deg,rgba(255,255,255,0.7) 0%,#fff 70%); } .home .home-authors .item-tobe-author .tobe-author, .home .item-author .item-top { margin: 30px 10px 10px 10px; padding: 15px; } .item-author .item-top { position: relative; box-shadow: 0 12.5px 25px 0 rgba(0,0,0,0.02); background-color: #fff; z-index: 1; } .item-author .author-intro { padding-left: 70px; } .item-author .author-intro { display: block; position: relative; min-height: 37.5px; padding-left: 70px; } .item-author .author-avatar { position: absolute; left: 0; top: 0; font-size: 37.5px; margin:15px 10px; width: 60px; height: 60px; } .author-name { font-size: 15px; color: #333; margin-bottom: 5px; display: flex; white-space: nowrap; } #user-list .item-author .author-name .uname { margin-right: 10px; display: inline-block; vertical-align: middle; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .author-name .uname, .author-name b { font-weight: bold; font-size: 15px; margin-right: 10px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; } .author-name .long-label { display: flex; justify-content: center; align-items: center; } .author-meta span, .ap-item-meta { font-size: 13px; color: #b5b5b5; margin-right: 5px; } .item-author .author-info { font-size: 14px; margin-top: 25px; margin-right: -16px; margin-left: -16px; padding: 0px 16px; color: #b5b5b5; text-align: center; line-height: 30px; background: #f5f5f5; height: 30px; border-radius: 4px; overflow: hidden; } .item-author .author-info i { margin-right: 5px; } .home .item-author .author-btn { position: absolute; right: 0; top: 80px; display: none; width: 100%; } .item-author .author-btn .looo { line-height: 13px; font-size: 13px; width: 100%; color: #333; background: #fff; } .item-author .item-bottom { font-size: 8.75px; position: relative; z-index: 1; padding: 0px 15px 15px 15px; height: auto; overflow: hidden; box-sizing: border-box; } .home .item-author .item-bottom-title { margin-top: 0px; } .item-author .item-bottom-title { font-size: 15px; color: #b5b5b5; font-weight: normal; margin-top: 20px; margin-bottom: 0px; } .item-author .ap-item { font-size: 14px; margin: 15px 0px 0px; } .item-author .ap-item-wrap.has-thumb { padding-left: 110px; min-height: 47.5px; } .item-author .ap-item-wrap { display: block; position: relative; } .item-author .ap-item-wrap .ap-item-thumb img{ width:100%; height:100%; } .item-author .ap-item-wrap .ap-item-thumb { position: absolute; left: 0; top: 0; width: 100px; height:70px; overflow: hidden; } .item-author .ap-item-wrap.has-thumb .ap-item-title { height: 45px; overflow: hidden; font-weight: normal; } .item-author .ap-item-wrap .ap-item-title { font-size: 14px; } .item-author .ap-item-wrap .ap-item-title { line-height: 1.5em; /* color: var(--key-color);*/ color:#333; margin-bottom: 7px; } .author-meta span, .ap-item-meta { font-size: 13px; color: #b5b5b5; margin-right: 5px; } .post-list-cat { font-size: 12px; } .ap-item-meta .post-list-cat:before { content: '#'; /* top: 2px; */ line-height: 12px; width: 12px; height: 12px; margin-right: 5px; color: #fe2c55; text-align: center; float: left; background: rgba(254, 44, 85, 0.2); border-radius: 50%; display: block; /* position: absolute; */ left: 0; } .item-author .author-avatar img { box-sizing: border-box; padding-top: 0; height: 60px; border: 0px solid #ffbc00; border-radius: 100%; overflow: hidden; } .item-author .item-wrap:hover .item-top .author-btn,.home-authors .item-tobe-author .item-wrap:hover .item-top .author-btn { display: block; } .jitheme-ranks .item-author .author-btn { position: absolute; right: 0; top: 100px!important; display: none; width: 100% } .user-s-follow button + button { margin-left: 10px; } .item-author .author-btn .user-s-follow { padding: 10px; text-align: center } .user-s-follow button { padding: 5px 10px; border:0px!important; } .blue-color { color: #2997f7!important; background-color: rgba(41, 151, 247, .1)!important; } .red-color { color: #ff5473!important; background-color: rgba(255, 84, 115, .1)!important; } .item-author .author-btn .user-s-follow { padding: 10px; text-align: center; } @media (max-width: 768px) { .home-authors .item, .home-authors .group-item .item-images .img-item{ width:100%!important; } #item-author:nth-child(n+4) { display:none; } } /*仿极主题首页人气作者结束*/ 文章很赞,支持一下吧~ 还没有人为TA充电 为TA充电 还没有人为TA充电 © 版权声明 版权声明 1 本站名称: 七九网单 2 本站网址:www.fengxue.cc 3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。 4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。 5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报。 6 本站附件资源、教程等内容如因时效原因失效或不可用,请评论区留言或联系站长及时更新。 THE END子比美化 喜欢就支持一下吧点赞15打赏 分享QQ空间微博QQ好友复制链接收藏如何下载资源?您可以通过搜索或浏览分类列表来找到您期望下载的资源。随后点击资源介绍页右侧的下载链接按钮,依据提示信息进行操作即可。是否需要充值才能下载?大部分资源可积分免费下载,为了维持网站的运行小部分资源须付费才能下载。下载的资源是否有版权?本站提供的下载资源均为网络搜集,仅供个人学习和交流使用。对于版权问题,请用户自行判断并承担相应责任。 上一篇 子比主题美化-GO跳转页v2.0版本 下一篇 子比主题美化 - 增加一个滚动公告框 评论 抢沙发 请登录后发表评论 登录 注册 暂无评论内容