Forums

Outputting the_excerpt (2 posts)

  1. RossKidd
    Member
    Posted 3 years ago #

    Hi,

    I want to output the last 3 posts abd the_excerpt for each. The_excerpt does not output in my example.

    <?php
     global $post;
     $myposts = get_posts('numberposts=5&amp;offset=0');
     foreach($myposts as $post) :
     ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>  <?php  the_excerpt(); ?></li>
     <?php endforeach; ?>
     </ul>
    </div>
  2. MichaelH
    Volunteer
    Posted 3 years ago #

    add setup_postdata($myposts); after the 'foreach'

Topic Closed

This topic has been closed to new replies.

About this Topic