Get and show latest post contents
-
Dear fellows,
I am trying to display only the last post’s title and contents on a page.
I am able to extract the appropriate post, but do not know how to display the contents.This is the code I am using:
<?php $args = array( 'numberposts' => '1' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a> '; } ?>
I tried using
get_content();
but it does not seem to help me.Can anyone please help?
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get and show latest post contents’ is closed to new replies.