how to get wordpress posts description and caption?

Iam trying to get 5 featured post from wordpress, to achieve this target i have offset 5 recent post .I successfully fetched post id , images . But i failed to get every posts description .i tried the code below but it only give me only 1 post description not all 5 .

$my_posts = get_posts(array('numberposts' => 5,
'offset'      => 5,
'orderby'     => 'post_date',
'order'       => 'DESC',
'post_type'   => 'post',
'post_status' => 'publish'));


  foreach($my_posts as $post) {

$data[] = 

    array(
       "id" => $post->ID,
      "title" => $post->post_title,
      "image" => get_the_post_thumbnail($post->ID),
     // "content" =>$post['post_excerpt'] 
      "content" => apply_filters('the_content', $post->post_content)
    );
                       }

Related posts

Leave a Reply

1 comment

  1. You get the description the_content() function within the loop. More information about this function is on this page

    For caption, you could use the_excerpt() function with the loop