给子比主题添加一个哔哩哔哩404页面

图片[1]-给子比主题添加一个哔哩哔哩404页面-瀚星阁

页面代码

将页面代码添加到子比主题中的404.php

<?php
/*
 * @Author        : Qinver
 * @Url           : zibll.com
 * @Date          : 2020-09-29 13:18:36
 * @LastEditTime: 2023-10-26 21:33:19
 * @Email         : 770349780@qq.com
 * @Project       : Zibll子比主题
 * @Description   : 一款极其优雅的Wordpress主题
 * @Read me       : 感谢您使用子比主题,主题源码有详细的注释,支持二次开发。
 * @Remind        : 使用盗版主题会存在各种未知风险。支持正版,从我做起!
 */
    $imageFolder = 'https://www.vxras.com/wp-content/themes/vxras/img/404/';
    $imageFiles = scandir($imageFolder);
    $imageFiles = array_diff($imageFiles, array('..', '.'));
    $randomImage = $imageFiles[array_rand($imageFiles)];
get_header();?>
<style>
.error-split {
    width: 100%;
    height: 40px;
    background: url(https://demo.vxras.com/wp-content/themes/ACG-child/Assets/img/have_rest.png) center no-repeat;
    padding: 50px;
}
.bilibilibtn {
    display: block;
    position: relative;
    background: var(--theme-color);
    border: 1px solid transparent;
    border-radius: 50px;
    height: 50px;
    text-align: center;
    text-decoration: none;
    color: #fff;
    line-height: 50px;
    font-size: 18px;
    padding: 0 70px;
    white-space: nowrap;
    margin-top: 25px;
    /* transition: background .5s ease; */
    overflow: hidden;
    transition: all 0.3s;
}
</style>
<main class="main-min-height">
  <div class="f404">
      <img src="https://cn-sy1.rains3.com/anxkj.fun/%E5%9B%BE%E7%89%87/des.png">
      </div>
      <div style="text-align: center; padding: 20px 0 40px 0;">
               <p class="muted-3-color">肥肠抱歉,你要找的页面不见了~</p>
               <button style="padding: 15px 50px; font-size: 15px;background:var(--body-bg-color);border: 5px solid var(--theme-color);border-radius: 15px;"><a href="/">返回主页</a></button>
               <div class="error-split" id="up"></div>
              <a href="/" style="position: fixed;bottom: 60px;left: 50%;transform: translateX(-50%);z-index:999;"><button class="bilibilibtn">返回首页</button></a></div>
  <div class="theme-box box-body main-search">
    <?php
    if (_pz('404_search_s', true)) {
      echo zib_get_main_search();
    }
    ?>
  </div>
           <div style="text-align: center; padding: 20px 0 40px 0;">
              <img src="<?php echo $imageFolder . $randomImage ?>" alt="随机图片">
             </div>
</main>
<?php get_footer();

在子比主题设置中的404显示搜索关闭

代码来源于炙焰博客

© 版权声明
WWW.ANXKJ.TOP
喜欢就支持一下吧
点赞5 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容