I’m quite a novice with PHP, but would like some assistance with how to display the latest 3 posts at the bottom of a page in wordpress. I want the title of each post displayed, along with the image belonging to the post and maybe the first line of text in the post, with a read more button, that I can then style with CSS to match the rest of the site.
Is this easy to achieve?
Thank you for any help.
Retrieving the posts can be done with
get_posts():In terms of rendering the posts, it would be worth checking whether your theme (or an installed plugin) provides some kind of “post preview” widget. If it does, save some heartache and use it. If it doesn’t, you can print the posts yourself along these lines: