trouble with get posts
-
I have been working on this for hours along with google. I am trying to access the wordpress posts in array form so that I can put them into a switch statement. Everything points to using get_posts(); I am trying it this way
$args = array( 'numberposts' => 3,'category' => 3 ); $lastposts = get_posts( $args ); print_r($lastposts[0]); $one = $lastposts[0]; $two = $lastposts[1]; $three = $lastposts[2]; echo $one->post_content;
The code below does show the array of posts on my page
print_r($lastposts[0]);
my problem is that when I try to echo or print out the content by doing
echo $one->post_content;
nothing happens. Nothing shows on the homepage and I don’t understand why.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘trouble with get posts’ is closed to new replies.