Get_posts example from DOCS not working.
-
Hi all,
I pasted the example of get_posts from the support docs into my site and I am getting the following error:
“invalid argument supplied for foreach()”
I am using the latest version of WP and here is the code:
<ul>
<?php
$posts = get_posts('numberposts=5&offset=1&category=1');
foreach($posts as $post) :
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> --- <?php the_excerpt(); ?></li>
<?php endforeach; ?>
</ul>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get_posts example from DOCS not working.’ is closed to new replies.