The key to this is covered on the get_posts
codex page: Access all post data using the setup_postdata
function:
foreach ( $rand_posts as $post ) : setup_postdata($post);
Regarding the_date
, see the note about multiple instances on a page:
SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template Tag the_time() or get_the_date() (since 3.0) with a date-specific format string.
Related Posts:
- Why time functions show invalid time zone when using ‘c’ time format?
- Query between two meta values?
- Get posts by meta value with date
- Generate an Email address from that of the Post Author
- How to show Published date and/or Modified date
- How can I show many posts an author has per week?
- Time & Date on Post – Time Ago Custom Function
- How to remove Date from Meta Description on SERP?
- Sort Posts By Custom Field Date?
- How is the author’s name given a different color?
- Get the author meta adds now
- Conditional For get_the_author_meta
- Media attachment date and post date
- wpdb->get_var – count author posts, meta value
- Post Publish date not display on Umaya Child themes
- Check For get_post_meta on Author Archive Page
- How can i set media attachments to the author of the post or page for already existed posts with attachments
- Update post meta date always store 1970-01-07
- How do you update post date (year only) in a separate custom field?
- How to hide meta from search result only on pages?
- How can I prevent the post_modified column in wp_posts from being updated?
- How to update the ‘modified_time’ of a post ONLY when content is changed?
- Sorting meta box values by start- and enddate and all dates in between
- How do I retrieve the slug of the current page?
- How to extract data from a post meta serialized array?
- How to save an array with one metakey in postmeta?
- WordPress is stripping escape backslashes from JSON strings in post_meta
- Unable to select an old date in wordpress
- Lack of composite indexes for meta tables
- Content hooks vs User hooks
- How to remove published date from RSS feed
- Save both current and new version of post meta
- get_post_meta – get a single value
- get_post_meta / update_post_meta array
- Triple meta_key on custom SELECT query
- update_post_meta not adding anything.(Nor add_post_meta)
- Identifying Importer Posts
- How metadata API works?
- How to sanitize post meta field value?
- Post IDs missing on delete_postmeta action hook
- How trigger to save post when updating post meta
- Create a Metabox that behaves Like a Taxonomy Box
- Views count with time limit per IP
- order by multiple meta_keys?
- Calculate future date
- echo image caption
- get_*_meta doesn’t always return an array
- If modified on same day, show only time
- Generate multiple goo.gl shortlinks for qtranslate bilingual blog
- How can I convert postmeta from unserialized to serialized?
- Make WordPress use timezone for email Date header
- add_post_meta adds meta to one more different post
- Custom query, multiple custom keys
- Trying to get property of non-object error using get_post_meta()
- Ordering posts by custom field named “date” in backend
- How can I change the tag contents of individual WordPress posts?
- get_post_meta producing white screen of death
- update_post_meta not working in plugin
- Look up all posts by status or meta value – performance difference
- How to restrict an author scheduling their post date to a maximum X days ahead from the current date
- Can A Post Meta Field Store multiple values that are not in an array?
- esc_attr on get_post_meta [closed]
- Sort custom posts in archive by multiple values: date AND meta key
- How to get User Time Zone in WordPress?
- How does WordPress treats attachments metadata in post content?
- URL to Post Meta [closed]
- Retrieving post meta array (attachment)
- Why is variable that get_post_meta stored in empty?
- Show different time stamp based on time
- Stop `update_post_meta` from working each time page refreshes?
- How to remove “Image Information” and “post date/author” from a media page?
- get_post_meta in one post only
- I want to Add Feedburner Right After Meta Details
- if get_post_meta function returns empty – Do Not Display HTML
- Custom column on CPT not showing correct value when meta data not set
- How to access post meta on the first time a post is published
- I Can’t get the post_tag name from term_id using wp_set_object_terms
- After updating the custom post type, metafields disappear from the post.php edit menu, how do I fix it?
- How to update/add child posts meta whenever the parent post meta is updated?
- How to query post with meta?
- why is my postmeta table is so heavy
- update_post_meta() throws Uncaught error: Cannot create duplicate attribute
- Using a comma instead of a pipe to separate metadata
- show user based on user_meta
- Meta keys won’t add using wp_insert_post
- Get current week’s day and time outside the loop
- How Can I extract Image urls from post meta
- Twenty Twelve entry meta data – change and move
- Use an id on a button to update_post_meta in post
- Using mysql queries to delete custom post types based on meta_value
- get_post_meta image width for lazy load
- Custom Fields help
- Comment time is same as the post time
- WP-API : post_meta not updated… but have another entry
- Parse error thrown by get_post_meta [closed]
- How to get all the related ids without array?
- Remove action of an external plugin after checking if custom post meta is set
- wordpress query making site very slow
- if condition from post_meta not working in save_post
- How to customize Date Format for American visitors?