文章描述:
404页面是访问的内容不存在或者是访问地址错误的给用户提示的页面,404页面是给用户体验更好的提示,也对seo有正面的影响(搜索引擎认为拥有404页面的网站会有更好的用户体验,会给予相应的加分)。
新建文件
在主题目录下面新建文件404.php
html
<?php get_header();?>
<div class=\"container\">
<div id=\"page-box\">
<div class=\"post-item _404\">
<div class=\"post-content\">您当前访问的页面不存在!<font id=\"jump\">3</font> 秒后返回首页,或<a href=\"<?php bloginfo(\'url\'); ?>\">直接返回</a></div>
</div>
</div>
</div>
<?php get_footer();?>
css
.div_404{max-width: 1200px; padding: 200px 0; background: #fff; margin-top: 30px; margin-bottom: 50px;}
.div_404 h2{font-size: 12em; text-align: center; padding-bottom: 50px;}
.div_404 .post-content{text-align: center; font-size: 1.4em;}
.div_404 .post-content font{color: #f70000;}
.div_404 .post-content a{color: #00AAEE;}
js
function countDown(secs){
$(\"#jump\").html(secs);
if(--secs>0){ setTimeout( \"countDown(\" + secs + \")\",1000 );
}else{
window.location.href=\"<?php bloginfo(\'url\'); ?>\";
}
}
countDown(3);
THE END
请登录后查看评论内容