[wp-hackers] get_posts problem...
Jeremy Visser
jeremy.visser at gmail.com
Wed Mar 5 01:21:27 GMT 2008
On Tue, 2008-03-04 at 20:13 -0500, spencerp wrote:
> <?php $latest_posts = get_posts('numberposts=3&offset=0');
> foreach ($latest_posts as $latest_post) : ?>
I later realised that won't work, because it's still using
the_permalink() and the_title() later on.
We need to do some query_posts() mojo.
Like maybe
<?php
global $wp_query, $wp_old_query;
$wp_old_query = $wp_query;
query_posts('numberposts=10&offset=0');
while ( have_posts() ) :
the_post();
?>
<li>
<ul>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title() ?>"><?php the_title() ?></a></li>
</ul>
</li>
<?php
endwhile;
$wp_query = $wp_old_query;
?>
--
Jeremy Visser http://jeremy.visser.name/
() ascii ribbon campaign — against HTML e-mail
/\ http://asciiribbon.org/
More information about the wp-hackers
mailing list