Display post’s description and caption
Something like this should get you close (untested):
<?php
foreach($my_posts as $post){
$thisPostId = $post->ID;
$thisPost = $get_post($thisPostId);
$thisPostTitle = apply_filters('the_title', $thisPost->post_title);
$thisPostThumbnail = get_the_post_thumbnail($thisPost);
$thisPostContent = apply_filters('the_excerpt', $thisPost->post_excerpt);
$data[] = array(
"id" => $thisPost,
"title" => $thisPostTitle,
"image" => $thisPostThumbnail,
"content" => $thisPostContent
);
}
?>
Related Posts:
- Display post details by post ID
- get posts based on category and post meta
- What does setup_postdata ($post ) do?
- Query for custom post type? [closed]
- get_posts – get all posts by author id
- Exclude Current Post from Recent Posts Loop
- get_post random and order by not working
- get_posts with meta_compare=’LIKE’ not working
- Sort “get_pages” by menu order not ordering
- Get the exact SQL query that get_posts() generated
- get_posts inside cron
- get_posts returning empty array
- Problem with get_posts, tax_query and counting the number of posts
- WP Query post meta value
- Filtering custom post type query
- Check If posts exist in custom post type category, outside of loop
- Get posts by meta value with date
- data returned from get_post($postId) have different keys than wp-json/wp/v2/posts/{postId}
- How to limit get_posts()?
- meta_query date and time comparisons
- What’s the difference between “get_posts” and “wp_get_recent_posts” when used with “setup_postdata”?
- get_posts gives different result than wpdb->get_results
- How to generate a list of posts published on current day?
- Trouble using get_post
- Ordering posts by metadata
- Get latest posts from multiple categories
- Get_Posts, only if in both categories
- Posts not showing in correct Alphabetical or ID order when using get_posts / orderby but only on production server
- Secondary Query Is Breaking Main Query
- If clauses in get_posts query
- var_dump and print_r cause white screen
- How can I display a single post link, based on title sample and change monthly?
- get_posts() doesn’t consider user permissions
- Meta query: get posts with value in a multidimensional array
- Better way to list links with different meta values using same meta key?
- Copy content stored in meta to post content
- How to update all posts but the current one (post__not_in not working?)
- Bulk updates to post_content
- Only showing the_date and the_excerpt for first entry in get_posts
- get_post_meta slowing down my page load (in a plugin)
- Query Problem in getting top viewed posts
- get_posts in meta box dropdown not showing latest posts
- get_posts not working as expected
- Get all pages and posts with get_pages() or get_posts()
- Exclude post format from get_posts
- get_posts() using an array of post ids [closed]
- Get only used meta_values
- Iterate over get_post_meta() result
- Look up all posts by status or meta value – performance difference
- Inserting post content into pages when using custom taxonomies
- Unique Problem with the php date and get_posts
- Get posts by language in Polylang plugin
- Query get_posts by level depth
- Auto-change Post Status on First Page Load
- How to get post content from an array of ids?
- How to use WordPress Conditional Tags in get_posts foreach loop
- SQL query generated by WP_Query is not the same what request echoes
- Calling setup_postdata() causes “Call to undefined function get_userdata()” error?
- Woocommerce: order posts by meta key
- WordPress Random post (last 3 days posts)
- Cron task firing but function not working
- wp json api – get posts by category
- Custom Post type Query post is not working
- Get all posts with a certain meta key, except for one with specific title
- List all pages including archive
- Modified home page query does not yield expected results
- Add ul to its children with get_posts
- get_posts by id not working
- Select objects from get_posts()
- Using post title as term in query, only working with single word titles
- Single random post in homepage
- Get posts in archive page
- Paging result of get_posts in function
- How to save HTML data into SQL post_content column
- get value from get_post_meta then reuse it in another get_post_meta
- Get_post_custom not fetching value from array wordpress
- get_posts returning empty array
- Update all WordPress posts’s title and content then display them in a table
- get_post Question
- get the_content by ID and save the result to one array
- get_posts – check if custom field has content?
- Zero posts returned with get_posts() on edit.php, but posts are returned on post.php
- get posts meta query returning the latest post if no meta key found
- Better way to query posts?
- Get number of posts in each category since last visit
- Get_posts not returning any posts when used with switch_to_blog
- Get images by category
- How To Use get_posts & get_the_post_thumbnail Outside The Loop
- How to create content automatically when a post is published?
- How to show only 1 post from a specific category on the front-page
- Query for draft or scheduled post
- get_posts() and ‘posts_per_page’ arg
- get_pages not returning any results or error when get_posts works
- Show posts in a list separated by day
- Function to get content by ID
- Custom Post Type meta value is being saved in array, instead of just the string (as value)
- How to show only text from post in WordPress
- Install wordpress and replace database (from previous site)
- NewsPaper WP Theme – Additional Related Posts Filter by Time (divTag composer)
- Translation related post text to Arabic