使用这款Seventeen主题有很久了,但是一直有一个问题,就是它的404页面有bug。对于某些不存在的链接,它并不显示预置的404页面,而显示的是网站主页。今天研究了下代码,给出我的解决方案:
在Seventeen主题的路径下新建一个叫做404.php的文件,输入以下代码:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?php get_header(); ?> 		<?php 		if (O('sidebar-pos') == 'left' || O('no-sidebar')) get_sidebar(); 		if (O('sidebar-card') && O('sidebar-pos') == 'right' && !O('no-sidebar')) 	get_template_part('module', 'cardtop'); 		?> 		<div id="content" class="wp"> 			<?php if (O('slider')) get_template_part('module', 'slider'); 			get_template_part('content', 'none'); 			?> 		</div><!-- #content.wp.center --> 		<?php if (O('sidebar-pos') == 'right' && !O('no-sidebar')) get_sidebar(); ?> 	</div><!-- #container.wc.center --> 	<script type="text/javascript">nanobar.go(60);</script> <?php get_footer(); ?> | 
(莫名多出了一个</div>标签,但是原作者是这么写的,就不去深究了)
RainEggplant原创文章,转载请注明来自:Seventeen主题404页面错误的解决办法

 
	 Loading...
		Loading...