Show post except's when out of the loop
-
Hi
I want to display a panel of 3 recent posts, their image and an excerpt of the post on my homepage. The code I have is out of the loop and while it works to some extent (does pull an excerpt for one of the posts) – it actually repeats the same excerpt for all 3.
<ul> <?php $IDOutsideLoop = $post->ID; global $post; $myposts = get_posts('showposts=3'); foreach($myposts as $post) : ?> <li> <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a> <?php echo substr(get_the_excerpt(), 0,30); ?> </li> <?php endforeach; ?> </ul>
Any ideas what I’m doing wrong?
Thanks ??
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Show post except's when out of the loop’ is closed to new replies.