我的single.php,archive,index和category.php页面使用下面的代码完全相同...
<?php
/*
Template Name: Lisa-beauty.co.uk
*/
?>
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="headpostedin"><?php the_time('l, F jS, Y') ?> </div>
<div class="content" id="post-<?php the_ID(); ?>">" rel="bookmark" title="<?php the_title_attribute(); ?>"><div class="headtitle"><?php the_title(); ?></div>
<div class="postmetadata"></div>
<?php the_content(__('CONTINUE READING...')); ?>
<?php the_tags('Tags: ', ', ', '
'); ?>
<div class="headposted"><?php comments_popup_link('0', '1', '%'); ?> comments</div>
<?php echo DISPLAY_ULTIMATE_PLUS(); ?>
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
每个人都可以在我的整个网站lisa-beauty.co.uk上正常工作但是只要我在侧边栏中点击我的档案然后到页面http://lisa-beauty.co.uk/lisa-beauty/?m=201509&paged=4我的整个容器和侧边栏都完全关闭但在其他页面上他们在我的档案中没问题。
可能导致此问题的原因是什么?
这是我的header.php和footer.php的编码
<!DOCTYPE html>
<head>
<meta name="description" content="Beauty uk blogger">
<meta name="keywords" content="blogger, beauty, fashion, make up">
<meta name="author" content="Lisa Robinson">
<meta charset="UTF-8">
<title>Lisa's Beauty UK Blog!</title>
<style type="text/css" media="screen"> @import url(/wp-content/themes/twentytwelve1/style.css);</style>
<?php wp_head(); ?>
</head>
<body>
<a name="top"></a>
<div id="container">
<div id="header" onclick="window.location='http://lisa-beauty.co.uk'">
</div>
<div id="content">
<div class="content">
</br>
</div>
页脚
<div id="foot">
<div id="footer-wrapper">
</div>
</div>
<div class="top">
<a href="#top" title="Go up"><u>↑ up</u></a>
</div>
<div class="left">
<div class="copyright">
Copyright 2015 www.lisa-beauty.co.uk <u>All rights reserved</u> | Powered by Wordpress | Theme by <a href="http://www.akaleez.co.uk/"><u>Akaleez</u></a>
</div>
</div>
<?php get_sidebar(); ?>
<?php wp_footer(); ?>
</body>
</html>
答案 0 :(得分:0)
这很可能是由某个流氓关闭div引起的。但是,正如sticku所说,调试此代码非常困难。
一些一般性指示:
1)缩进代码
调试此
要容易得多<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="headpostedin">
<?php the_time('l, F jS, Y') ?>
</div>
<div class="content" id="post-<?php the_ID(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
<div class="headtitle">
<?php the_title(); ?>
</div>
<div class="postmetadata">
</div>
<?php the_content(__('CONTINUE READING...')); ?>
<?php the_tags('Tags: ', ', ', ''); ?>
<div class="headposted">
<?php comments_popup_link('0', '1', '%'); ?> comments
</div>
<?php echo DISPLAY_ULTIMATE_PLUS(); ?>
<?php comments_template(); // Get wp-comments.php template ?>
</div>
<?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
比你上面发布的那样。
<强> 2。如果您使用的是<br />
代码,则应该是</br>
第3。验证您的代码。
如果您遇到过类似的布局问题,请通过W3C validator运行代码,99%的时间会为您提供有关潜在问题的一些很好的线索。
我认为主要问题在于这一行:
<div class="content" id="post-<?php the_ID(); ?>">" rel="bookmark" title="<?php the_title_attribute(); ?>">
因为你有一个额外的报价和关闭括号。试试这个:
<div class="content" id="post-<?php the_ID(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
另请注意,在上面的例子中,我已经将底部的最终结束</div>
移动到循环内部,因为最好关闭与抽象相同的div作为打开时的div(原因是如果没有返回结果,则不会返回开始div,但是无论如何都会返回结束div,这会破坏页面。)