I am having a problem with the the_excerpt();
tag which I am using in my own theme in the index.php and archive.php files. The code is below:
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(); ?>
Sorry for the long pieces of code.
I am not sure exactly where the problem lies and would be grateful for any help you can provide.
Many thanks,
nav
Thank you for all your help, especially @byronyasgur for your last suggestion. It helped me fix it.
I was using markdown as the input format for the content, and the first line was HTML comment which was not followed by a blank line. Adding a blank line fixed it.
Summary: The absence of this line caused the excerpt to be null. This blnak line did exist in my development system but not on the live system.
Markdown users beware of the need of blank lines.
Sorry for the noise.