WordPress.org

Ready to get started?Download WordPress

Forums

Help with geth_the_excerpts() (2 posts)

  1. walshie1987
    Member
    Posted 1 year ago #

    Hi,

    I'm having problems with the following code:

    [code]
    <?php
    global $post;
    $myposts = get_posts('numberposts=3&category=10');
    foreach($myposts as $post) :
    ?>

    <td width="133px" style="border:none; padding-left:2px; max-width:133px;">

    <?php echo get_the_post_thumbnail($post->ID, 'thumbnail'); ?>

    <li style="padding-left: 2px; text-align:center">"><?php the_title(); ?><?php
    echo get_the_excerpt($post);?>

    </td>
    <?php endforeach; ?>
    [/code]

    Basically what should happen is that for the last three posts in category 10 the thumbnail, title and excerpt should be displayed.

    What is actually happening is that the thumbnail and titles are all different (as they should be, as they are different posts) but the excerpt is the same for all three posts.

    I've tried everything and can't figure this out, any ideas?

    Thanks in advance for your help!

    Chris

  2. zex2911
    Member
    Posted 1 year ago #

    Try instead of

    <?php echo get_the_excerpt($post);?>

    to put

    <?php the_excerpt(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.