!
您也想出现在这里吗? 点击联系我们
内容广告区块
当前位置:首页>源码分享>B2源码> B2主题动态滚动公告显示订单成交信息

B2主题动态滚动公告显示订单成交信息

本文是《免费(共168篇)》专题的第 168 篇。阅读本文前,建议您先阅读前面的文章:

B2主题动态滚动公告显示订单成交信息

美化图:

B2主题动态滚动公告显示订单成交信息

该美化有用到jquery请自行引入,如您已经引入过则可以忽视

第一步:

在合适的位置插入以下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代码

/*网站动态开始*/@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中添加以下代码

function B2Danmu_allinfo_data($data){
    global $wpdb;
    $table_name = $wpdb->prefix . 'zrz_order';
    $all_select = $wpdb->get_results( "SELECT * FROM $table_name WHERE order_state='q' AND order_type<>'mission'  ORDER BY id DESC LIMIT 20",ARRAY_A);
    $data = array();
    foreach($all_select as $key=>$v) {
        //获得user_id的名字
        $user_id_name = get_userdata($all_select[$key]['user_id']);
        $user_id_name_true = isset($user_id_name->display_name) ? esc_attr($user_id_name->display_name) : '';
        $user_id_link=get_author_posts_url($all_select[$key]['user_id']);
        //获得msg_users的名字
         
        $msg_users_name = isset($all_select[$key]['msg_users']);
        //$msg_users_name_tian= trim($msg_users_name,"[]");
        $msg_users_name_jun=preg_replace( '/[\W]/', '', $msg_users_name);
        $msg_users_name_ya = get_userdata($msg_users_name_jun);
        //获取用户名         
        $msg_users_name_true = isset($msg_users_name_ya->display_name) ? esc_attr($msg_users_name_ya->display_name) : '';
        $msg_users_link=get_author_posts_url($msg_users_name_jun);
        if($all_select[$key]['order_type']=='vip') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="/vips" target="_blank" class="info_zianv2">VIP会员</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>购买<i></i>'.$answer_user_page;
        } 
        elseif($all_select[$key]['order_type']=='cg') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $answer=$user_id_name_true.'花了'.$all_select[$key]['order_price'].'元<i></i>购买积分';
             
        }
        elseif($all_select[$key]['order_type']=='circle_join') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $answer=$user_id_name_true.'花了'.$all_select[$key]['order_price'].'元<i></i>加入付费圈子';
             
        }
        elseif($all_select[$key]['order_type']=='ds') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'打赏<i></i>'.$answer_user_page.'<i></i>的作者<i></i>'.$msg_credit.'元';
        }elseif($all_select[$key]['order_type']=='infomation_sticky') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                 
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>置顶一则供求信息';
        } 
         
        elseif($all_select[$key]['order_type']=='x'&& $all_select[$key]['pay_type']=='credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                    $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>购买文章<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='x'&& $all_select[$key]['pay_type']<>'credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>购买文章<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='circle_hidden_content_pay'&& $all_select[$key]['pay_type']=='credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                    $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>查看帖子<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='circle_hidden_content_pay'&& $all_select[$key]['pay_type']<>'credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>查看帖子<i></i>'.$answer_user_page.'<i></i>';
        }
        elseif($all_select[$key]['order_type']=='w'&& $all_select[$key]['pay_type']=='credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                    $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>购买隐藏文章<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='w'&& $all_select[$key]['pay_type']<>'credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>购买隐藏文章<i></i>'.$answer_user_page.'<i></i>';
        }
        elseif($all_select[$key]['order_type']=='v'&& $all_select[$key]['pay_type']=='credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
                    $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>购买视频<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='v'&& $all_select[$key]['pay_type']<>'credit' ) {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>购买视频<i></i>'.$answer_user_page.'<i></i>';
        }
        elseif($all_select[$key]['order_type']=='gx') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>购买商品<i></i>'.$answer_user_page.'<i></i>';
        }
            elseif($all_select[$key]['order_type']=='coupon') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $answer=$user_id_name_true.'使用优惠券购买商品';
        }
        elseif($all_select[$key]['order_type']=='d') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>兑换商品<i></i>'.$answer_user_page.'<i></i>';
        }
        elseif($all_select[$key]['order_type']=='c') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer_user_page='<a href="'.get_permalink($all_select[$key]['post_id']).'" target="_blank" class="info_zianv">'.get_post($all_select[$key]['post_id'])->post_title.'</a>';
            $answer=$user_id_name_true.'花了'.$msg_credit.'积分<i></i>抽奖商品<i></i>'.$answer_user_page.'<i></i>';
        }
         elseif($all_select[$key]['order_type']=='cz') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $answer=$user_id_name_true.'充值<i></i>'.$all_select[$key]['order_price'].'元<i></i>';
        }elseif($all_select[$key]['order_type']=='verify') {
            $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $msg_credit=$all_select[$key]['order_price'];
            $answer=$user_id_name_true.'花了'.$msg_credit.'元<i></i>进行<i></i><a href="/verify" target="_blank" class="info_zianv2">高级认证</a>';
        }  else {
                $avatar = get_avatar_url($all_select[$key]['user_id'],array('size'=>160));
            $infeo_link=$user_id_link;
            $answer='欢迎访问本站';
        }
        $answer_list = array(
           
           'answer'=>$answer,
         );
        $data[] = $answer_list;
    }
    return $data;
}
function goldwho_files() {
    wp_enqueue_script('goldwho_jquery_js',get_theme_file_uri('/pic/jquery-3.7.1.min.js'),array(),'1.0');
    
}
add_action('wp_enqueue_scripts','goldwho_files');
文章链接:https://sjcnh.cn/2380.html
文章标题:B2主题动态滚动公告显示订单成交信息
文章版权:@花醉 所发布的内容,部分为原创文章,转载请注明来源,网络转载文章如有侵权请联系我们!我们将在24小时内极速处理!
本文最后更新发布于2024年01月31日 11时40分44秒,某些文章具有时效性,若有错误或已失效,请在下方留言或联系:841134898@qq.com
本文声明 本站上的部份代码,教程,软件,插件来自会员发布以及互联网收集,不代表本站立场,仅供网友个人学习交流或测试研究使用,未经原版权作者许可,禁止用于任何商业途径!请用户仔细辨认内容的真实性,避免上当受骗!本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。请在下载24小时内删除!若您喜欢本文可附上原文链接随意转载。如无意侵害了您的权益,请发送邮件841134898@qq.com 或点击右侧 私信:花醉 反馈,我们将尽快处理。如果遇到付费才可观看的文章,建议升级终身VIP。全站所有资源“任意下免费看”。本站资源少部分采用7z压缩,为防止有人压缩软件不支持7z格式,建议下载7-zip。zip、rar解压,建议下载WinRAR。

给TA赞助
共{{data.count}}人
人已赞助
!
您也想出现在这里吗? 点击联系我们
内容广告区块
0 条回复Z文章作者V管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
有新私信 私信列表
有新消息 消息中心
快速搜索
在线客服
关注我们
  • 扫码打开当前页

  • 微信公众号

返回顶部