0

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?

2

Perhaps try this:

 <?php 
    global $more; 
    $more = false; 
 ?>
 <?php the_content('<span>Continue Reading</span>'); ?>
 <?php $more = true; ?>
  • 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
  • One last thing. Could you explain why this worked. It seems almost like a hack to fix something broken with WP. Also, how would you pull off an if excerpt box use. otherwise pull excerpt from content? – Zach Shallbetter May 23 '11 at 18:21

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.