Support » Themes and Templates » the_excerpt() not showing manual excerpt

  • Resolved Shasta


    I have a ‘page’ with a second loop that (should) show excerpts of posts in the category having the same name as the page. That’s working correctly, except that it always pulls an automatic excerpt, and never a manually entered excerpt. I’ve triple-checked that some of the posts on my test page do in fact have manual excerpts (I made them very different from the automatic one to avoid confustion) they’re just never showing up. The automatic one is showing up beautifully.


    Here is the code:

    <?php $thispage = $posts[0]->post_name; /*name of page calling the template*/ ?>


    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(__('(more...)')); ?>
    <?php endwhile; else: ?>
    <?php wp_reset_query(); ?>
    <p><?php _e('Page Temporarily Unavailable.'); ?></p>
    <?php endif; ?>


    <?php query_posts( array ( 'category_name' => $thispage, 'posts_per_page' => -1 ) ); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>


    <div class="storycontent">
    <?php the_excerpt(); ?>


    ‘<?php endwhile; else: ?>
    <?php wp_reset_query(); ?>`

    There ARE manual excerpts – -not sure how to reproduce that here. I entered them by turning on the excerpt box and adding them to posts (not pages) that display on my test pages. I made sure they were saved by leaving the post form and then coming back — there they are, but they don’t show up on the page.

    If it helps, the page is here:

    It’s under development, so may be in a state of flux.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, I’m a noob. Have exactly the same problem with this code:

    <? $pageChildren = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID."	AND post_type = 'page' ORDER BY menu_order", 'OBJECT');	?>
    <? if ( $pageChildren ) : foreach ( $pageChildren as $pageChild ) : setup_postdata( $pageChild ); ?>
    <div class="list-content">
    <h2><a href="<?php echo get_permalink($pageChild->ID); ?>" rel="bookmark" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?></a></h2>
    <?php excerpt('25'); ?>
    <br />
    <a class="read-more" href="<?php echo get_permalink($pageChild->ID); ?>">Read More</a>
    <? endforeach; endif; ?>

    It won’t pull up any manual excerpts only automatic excerpts i.e. it ignores manual ones.

    your theme seems to be using a ‘home-made’ function:

    <?php excerpt('25'); ?>

    try and replace this with:

    <?php the_excerpt(); ?>

    or dig into the code to find and modify the function excerpt(), probably in functions.php of your theme.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_excerpt() not showing manual excerpt’ is closed to new replies.