我对the_excerpt();标记有问题,我在index.php和archive.php文件中使用了自己的主题。守则如下:
index.php
<?php get_header(); ?>
<section class="center-column">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<!--<?php echo the_permalink(); ?>-->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="post-date"><?php the_time(get_option( 'date_format' )); ?></div>
</header>
<?php the_excerpt(); ?>
<footer class="post-footer">
<div class="categories">Posted in: <?php the_category(', '); ?></div>
<div class="tags">Tags: <?php the_tags(); ?></div>
</footer>
</article>
<?php endwhile; ?>
<section class="post-navigation">
<div class="alignleft">
<?php next_posts_link('« Older Entries') ?>
</div>
<div class="alignright">
<?php previous_posts_link('Newer Entries »') ?>
</div>
</section>
<?php else : ?>
<article>
<h3>Not Found</h3>
<p>Sorry, but you are looking for something that is not available</p>
</article>
<?php endif; ?>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>archive.php
<?php get_header(); ?>
<section class="center-column">
<!-- Archive Heading -->
<section>
<h3 id='archive-heading'>
<?php if (is_category()) { ?>
Archive for the '<?php single_cat_title(); ?>' Category
<?php } elseif (is_tag()) { ?>
Posts Tagged '<?php single_tag_title(); ?>'
<?php } elseif (is_month()) { ?>
Archive for <?php echo get_the_date('F Y'); ?>
<?php } ?>
</h3>
</section>
<!-- End Archive Heading -->
<!-- Post Excerpt -->
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="post-date"><?php the_time(get_option( 'date_format' )); ?></div>
</header>
<?php the_excerpt(); ?>
<footer>
<div class="categories">Posted in:
<?php the_category(', '); ?>
</div>
<div class="tags">Tags:
<?php the_tags(); ?>
</div>
</footer>
</article>
<?php endwhile; ?>
<?php endif; ?>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>抱歉,代码太长了。
我不清楚问题究竟在哪里,如果你能提供任何帮助,我将不胜感激。
非常感谢,纳夫
发布于 2012-04-05 02:46:22
感谢您的帮助,特别是@byronyasgur给您的最后一个建议。它帮我修好了。
我使用标记作为内容的输入格式,第一行是HTML注释,后面没有空行。添加了一个空行,修复了它。
摘要:这一行的缺失导致摘录为null。在我的开发系统中确实存在这条blnak线,但在实时系统中却没有。
标价用户注意空白行的需要。
抱歉噪音太大了。
https://wordpress.stackexchange.com/questions/48009
复制相似问题