B2pro主题美化增加动态滚动公告来显示订单信息

美化说明:
这篇文章介绍了B2主题美化方面的内容,主要增加了动态滚动公告来显示订单信息;
并提供了实现该功能的三步骤:
第一步和第二步的具体操作未详细说明,
第三步则是需要在主题的functions.php文件中添加代码。
文章同时提醒,为了安全起见,在修改前需要备份数据,并指出该功能使用了jquery库,需要自行引入。
最后提供了相关HTML和CSS代码的示例。
第一步:
在合适的位置插入以下HTML代码

<div id="rizhuti_v2_module_dynamic-5" class="section rizhuti_v2-widget-dynamic">
  <div class="wrapper">
    <div class="module owl-dynamic alert-primary">
      <span class="d-none d-lg-block float-left">
        <span class="badge badge-danger mr-2">
          <i class="b2font b2-notification-3-line"></i>网站动态
          </span>
      </span>
      <div class="scroll-dynamic" id="scroll-dynamic">
        <ul style="margin-top: 0px;">
          
         <?php
$arr=B2Danmu_allinfo_data($data);
    
    foreach($arr as $row){
       
        foreach($row as $cell){
            echo '<li>'.$cell.'</li>';
        }
        
    }
;
?>
        </ul>
      </div>
      <span class="float-right d-none d-lg-block">
             <small class="mr-2">用户
          <span class="badge badge-primary-lighten ml-1"><?php $users = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users"); echo $users; ?></span></small>
        <small class="mr-2">文章
          <span class="badge badge-primary-lighten ml-1"><?php $count_posts = wp_count_posts(); echo $published_posts = $count_posts->publish;?></span></small>
        <small class="mr-2">评论
          <span class="badge badge-primary-lighten ml-1"><?php echo $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments");?></span></small>
        <small class="mr-2">建站
          <span class="badge badge-primary-lighten ml-1"><?php echo floor((time()-strtotime("2023-11-01"))/86400); ?>天</span></small>
      </span>
    </div>
     
  </div>
</div>    
 
  <script>
      function autoscroll(obj){
 
                                     
 
          $(obj).find("ul:first").animate({marginTop:"-25px"},1000,function(){
              $(this).css("marginTop","0px").find("li:first").appendTo(this)
           })
       }
 $(document).ready(function(){
      setInterval('autoscroll("#scroll-dynamic")',1500)
 })
</script>



第二步:
在自定义css中添加以下CSS代码

在自定义css中添加以下CSS代码

/*网站动态开始*/@media screen and (max-width: 768px){
    .owl-dynamic .scroll-dynamic ul li {
        width: 280px!important; /* 设置容器宽度 */        overflow: hidden; /* 当内容超出容器宽度时进行隐藏 */        white-space: nowrap; /* 不换行 */         
}
 .float-left,.float-right{
     display:none!important;
 }   
    .owl-dynamic .scroll-dynamic{
        max-width:unset!important;
    }
     
}
.mr-2, .mx-2 {
    margin-right: 0.5rem!important;
}
 
.badge-danger {
    color: #f46;
    background-color: rgba(255, 68, 102, 0.15);
}
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 2;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
.float-left {
    float: left;
}
 
.d-lg-block {
    display: block;
}
#rizhuti_v2_module_dynamic-5{
    margin-bottom:20px;
}
#rizhuti_v2_module_dynamic-5 .owl-dynamic {
    color: #000;
   background: #fff;
     
}
#rizhuti_v2_module_dynamic-5 .owl-dynamic {
    position: relative;
    padding: 10px 15px;
    border-radius: 0.5rem;
}
.ml-1, .mx-1 {
    margin-left: 0.25rem!important;
}
.spinner-grow-sm {
    width: 1rem;
    height: 1rem;
}
.spinner-grow {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    background-color: currentColor;
    border-radius: 50%;
    opacity: 0;
    -webkit-animation: .75s linear infinite spinner-grow;
    animation: .75s linear infinite spinner-grow;
}
.small, small {
    font-size: 96%;
    font-weight: 400;
    color: #000;
    line-height: 2;
}
sup {
    top: -0.5em;
}
sub, sup {
    position: relative;
    font-size: 75%;
    line-height: 0;
    vertical-align: baseline;
}
 .spinner-border,
  .spinner-grow {
    -webkit-animation-duration: 1.5s;
    animation-duration: 1.5s;
  }
 
.owl-dynamic .scroll-dynamic {
    height: 25px;
    line-height: 25px;
    overflow: hidden;
    display: inline-block;
    max-width: 64%;
}
 
.owl-dynamic .scroll-dynamic ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.owl-dynamic .scroll-dynamic ul li {
    font-size:16px;
    font-weight: 600;
    height: 25px;
    padding-left: 0;
    line-height: 30px;
    white-space: nowrap; /* 防止换行 */        overflow: hidden; /* 超过部分隐藏 */        width:500px;
}
.owl-dynamic .scroll-dynamic ul li a{
    color:#f46;
   text-decoration:underline;
}
.dark-open a {
    color: #fff;
}
.float-right {
    float: right;
}
 
 
.d-lg-block {
    display: block;
}
.mr-2, .mx-2 {
    margin-right: 0.5rem!important;
}
.small, small {
    font-size: 16px;
    font-weight: 400;
    color: #000;
    line-height: 2;
}
small {
    font-size: 80% !important;
}
.badge-primary-lighten {
    color: #f46;
    background-color: rgba(255, 68, 102, 0.15);
    margin-bottom: 10px;
}
.ml-1, .mx-1 {
    margin-left: 0.25rem!important;
}
 
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 14px;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}
/*网站动态结束*/



第三步:
在主题functions.php中添加以下代码

温馨提示:本站提供的一切软件、教程和内容信息都来自网络收集整理,仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,版权争议与本站无关。用户必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解! 联系邮箱:lgg.sinyi@qq.com

给TA打赏
共{{data.count}}人
人已打赏
分享B2主题美化包、B2 pro主题美化包、B2子主题

7B2/子比主题 – 横幅文字广告位美化

2025-9-17 2:24:22

分享B2主题美化包、B2 pro主题美化包、B2子主题

B2主题美化教程仿制致美化页脚

2025-9-17 2:32:56

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索