[wp-hackers] get_posts problem...

Mr. Awesome theone.andonly.mr.awesome at gmail.com
Wed Mar 5 01:51:10 GMT 2008


Dan Larkin wrote:
> No go as in still a parsing error about a "?" or no go as in that method
> didn't work?

The method(s) not working. We're trying various things, here I'll tell 
you what we're doing and the results...

method 1:

<h4>latest<span class="altcolor"> posts</span></h4>
        <?php
$posts = get_posts('numberposts=10&offset=0');
foreach ($posts as $post) : ?>
<li>
<ul>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title(); 
?>"><?php the_title(); ?></a></li>
</ul>
</li>
<?php endforeach; ?>

Result: Shows the Latest Posts titles in top section like they supposed 
too, but there's still a normal POST on the Authors page... and not the 
Author page content...

Method 2:

<h4> latest <span class="altcolor">posts</span></h4>
<?php
global $wp_query, $wp_old_query;
$wp_old_query = $wp_query;
query_posts('numberposts=3&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
$wp_query = $wp_old_query;
endwhile;
$wp_query = $wp_old_query;
?>

Result: Shows the Latest TWO post titles in above section, and TWO posts 
in the author page, instead of one as we had in first Method. No Author 
Page content showing at all...


More information about the wp-hackers mailing list