Help with geth_the_excerpts() (2 posts)

  1. walshie1987
    Posted 3 years ago #


    I'm having problems with the following code:

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

    <?php endforeach; ?>

    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!


  2. zex2911
    Posted 3 years 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


No tags yet.