0

I am creating custom theme, I have included excerpt in the index file

<article class="post">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    <p class="post-info"><?php the_time('F j, Y g:i a'); ?> | by <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?></a></p>        

    <?php the_excerpt(); ?>         
</article>

This will create result like this

Fig 1

But when I click the heading of the post it will redirect to the post page correctly but only 55 words are displaying See below screen shot

Fig 2

  • Which file did you edit for adding <?php the_excerpt(); ?> – Robert hue Dec 2 '14 at 11:00
  • <?php the_excerpt(); ?> added in my index.php File – Relax Dec 2 '14 at 11:03
  • Okay, then in your single.php, make sure you <?php the_content(); ?> instead of <?php the_excerpt(); ?>. – Robert hue Dec 2 '14 at 11:06
  • If you don't have a single.php, make a copy of your index.php and rename it single.php and then just change the_excerpt() with the_content() – Pieter Goosen Dec 2 '14 at 11:07
0

If you adding this code in content.php then you should use conditions.

<?php if ( is_single() ) : ?>
    <?php the_content(); ?>
<?php else : ?>
    <?php the_excerpt(); ?>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.