WordPress博客知更鸟Begin主题给404页面添加文章归档

2022年7月3日20:00:05 发表评论

404页面自定义是每个网站不可以或缺的,不同的网站创意也有所不同。今天我们给就给知更鸟Begin主题的404页面加一个文章归档,操作很简单。

WordPress博客知更鸟Begin主题给404页面添加文章归档

具体步骤如下

第一步、找到文章归档的调用代码

打开begin/pages/template-archieves.php,

  1. <h2 style="margin-top: 3.5rem">  当然,你也可以看看其他精彩内容哟!</h2>  
  2. <style type="text/css">  
  3.  .year {  
  4.  font-size: 16px;  
  5.  margin: 10px -21px 10px -21px;  
  6.  padding: 0 20px;  
  7.  border-bottom: 1px solid #ebebeb;  
  8.  border-left: 5px solid #0088cc;  
  9.  }  
  10.  .mon {  
  11.  color: #000;  
  12.  line-height: 30px;  
  13.  margin: 5px 0 5px 5px;  
  14.  cursor: pointer;  
  15.  }  
  16.  .post_list li {  
  17.  line-height: 30px;  
  18.  text-indent: 2em;  
  19.  }  
  20.  .post_list {  
  21.  color: #999;  
  22.  margin: 0 0 10px 0;  
  23.  }  
  24.  .mon-num {  
  25.  color: #999;  
  26.  margin: 0 0 0 10px;  
  27.  }  
  28. </style>  
  29. <?php require get_template_directory() . '/inc/function/archives.php'; ?>  
  30. <div class="archives">  
  31.  <?php cx_archives_list(); ?>  
  32. </div>  
  33. <script type="text/javascript">  
  34.  $(document).ready(function(){  
  35.  (function(){  
  36.  $('#all_archives span.mon').each(function(){  
  37.  var num=$(this).next().children('li').size();  
  38.  var text=$(this).text();  
  39.  $(this).html(text+' <span class="mon-num">'+num+' 篇</span>');  
  40.  });  
  41.  var $al_post_list=$('#all_archives ul.post_list'),  
  42.  $al_post_list_f=$('#all_archives ul.post_list:first');  
  43.  $al_post_list.hide(1,function(){  
  44.  $al_post_list_f.show();  
  45.  });  
  46.  $('#all_archives span.mon').click(function(){  
  47.  $(this).next().slideToggle(400);  
  48.  return false;  
  49.  });  
  50.  })();  
  51.  });  
  52. </script>  

上面代码有增删,有增删,有增删(大家灵活使用)

第二步、编辑404页面

打开begin/404.php,在

  1. <?php get_search_form(); ?>  

后面粘贴第一步复制的代码。这样,功能需求就实现了,赶快来试一试,定制你自己的404页面吧。

Tips:

做副业长期赚不到钱的话很容易放弃,特别是对于新手来说,新手刚入行的时候期望值都比较高,以为进来就马上能赚到钱,但是现实却很残酷,很多新手都没能坚持到赚钱的时候。因此,我在朋友圈《加微信》会给大家推荐一些破零项目,钱虽然不多,但是我觉得能让很多新手做副业的信心不那么容易被打垮。

掘金网
  • 版权声明:本站原创文章,转载请保留出处和链接!
  • 本文链接:http://jjsoho.com/404wzgd/ 网赚有风险,投资需谨慎!