WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] the_excerpt() not showing manual excerpt (3 posts)

  1. shastaw
    Member
    Posted 3 years ago #

    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.

    Help?

    Here is the code:

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

    [NORMAL PAGE DISPLAY:]

    <?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; ?>

    [STATIC HTML HERE]

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

    [DISPLAY STUFF HERE]

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

    [RIGHT UP THERE -- WHAT'S WRONG?]

    '<?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: http://litsam.com/writers/

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

    Thanks,
    Shasta

  2. Pe Nis
    Member
    Posted 3 years ago #

    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>
    </div>
    <? endforeach; endif; ?>

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

  3. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags