Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I enabled custom excerpts on my pages with this function.

add_action('init', 'page_excerpts');

function page_excerpts() {
    add_post_type_support( 'page', 'excerpt' );
}

However, When I enter a data into the excerpt field I still have the content returning in the loop instead of my newly added excerpt.

<?php the_excerpt(); ?>

Do I need to do anything else to force the content to be pulled from the excerpt field on pages?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Perhaps try this:

 <?php 
    global $more; 
    $more = false; 
 ?>
 <?php the_content('<span>Continue Reading</span>'); ?>
 <?php $more = true; ?>
share|improve this answer
    
That seemed to give me a the full content instead of the excerpt. –  Zach Shallbetter May 20 '11 at 15:58
    
Oh, sorry, I didn't get that completely right. <?php global $more; $more = false; ?> <?php if (!empty($post->post_excerpt)) : ?> <?php the_excerpt(''); ?> <?php else : ?> <?php the_content('<span>Continue Reading</span>'); ?> <?php endif; ?> <?php $more = true; ?> –  Pippin May 20 '11 at 16:23
    
lol, so if it has the excerpt it pulls the excerpt from the content and if it doesn't have an excerpt it pulls ALL of the content images and all. Still not pulling from the excerpt box. –  Zach Shallbetter May 20 '11 at 16:54
    
Instead of using the_excerpt(), try echo $post->post_excerpt; –  Pippin May 20 '11 at 19:24
    
Awesome! Worked great –  Zach Shallbetter May 20 '11 at 23:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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