Display newest post’s custom field content on homepage, daily

It sounds like what you need is a custom secondary loop, probably using WP_Query, that just queries for your single most recent post. Once you have that, you can use get_post_meta() to grab the custom meta from that post in a new loop.


Edit:

Alternately, you can use get_posts() to get the first post’s ID and use that. Something like this:

$my_most_recent_post = get_posts( 'numberposts=1' );
$my_most_recent_post_id = $my_most_recent_post[0]->ID;
get_post_meta( $my_most_recent_post_id, 'my_custom_field', true );

Leave a Comment