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

2019年4月20日15:10:21 发表评论 3,831
摘要

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-size16px;
  5.  margin10px -21px 10px -21px;
  6.  padding: 0 20px;
  7.  border-bottom1px solid #ebebeb;
  8.  border-left5px solid #0088cc;
  9.  }
  10.  .mon {
  11.  color#000;
  12.  line-height30px;
  13.  margin5px 0 5px 5px;
  14.  cursorpointer;
  15.  }
  16.  .post_list li {
  17.  line-height30px;
  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页面吧。

 

 

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如果喜欢,请打赏支持本站,谢谢大家!

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: