If you type “WordPress get recent posts” into Google you will see, right at the top of the list, wp_get_recent_posts
. Follow that link and you will end up on that function’s “Function Reference” page in the Codex, where you will find, about halfway down, that someone has posted an example that does pretty much exactly what you want to do– create a list of post titles.
<h2>Recent Posts</h2>
<ul>
<?php
$recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.esc_attr($recent["post_title"]).'" >' . $recent["post_title"].'</a> </li> ';
}
?>
</ul>
It looks like you just registered, so in the future, be aware that you are expected to have researched the problem and made an attempt at solving it before posting a question.
Related Posts:
- Display recent posts with thumbnail within Masonry
- How do I use wp_get_recent_posts?
- Add Date to Recent Posts Widget?
- Recent Posts widget has some older posts at the top? [closed]
- how to show post content with post name in sidebar?
- Adding a badge to new blog post titles
- How to make slider show 4 recent news and news start from begining not from 4th
- Display recent post by tag
- Small intro before latest blog posts
- WordPress Recent post only showing title
- Recent post on single page from specyfic category
- How to display posts on template
- Help with “Recent Posts” Loop that is specific to a topic
- Get Each user recent post in wordpress
- Code for Recent Posts Widget
- Display list of most used tags in the last 30 days
- Modify recent post sidebar to show post thumbs with out plugins
- Querying post from a multisite network
- Display all comments or recent comments per user on author page
- Modifying recent post widget to include icons for post titles
- meta_query not working properly
- Unable to show recent custom post types in default recent posts widget
- Related Posts loop – offset
- customizing recent posts
- If numberposts = -1 offset won’t work
- Order posts by meta value and Date
- What’s the difference between “get_posts” and “wp_get_recent_posts” when used with “setup_postdata”?
- How can I show recent posts from same taxonomy as the post currently being viewed?
- How to display recent / random posts by its category
- Recent Posts widget without Title
- Change recent posts widget title
- Display most recent post on homepage?
- the_excerpt not showing posts
- How to truncate titles in Recent Posts widget?
- Customizing wordpress default widgets?
- Recent posts with featured image or fallback image with permalink
- Recent Posts slider, using WP_Query(), loads duplicate sliders
- Excluding a category from wp_query breaks recent post widget
- How do I add recent posts to the menu?
- WP Bakery Load More Button loads the same posts
- How to output only blockquotes content from recent posts in a widget?
- WP_Query with offset and ‘orderby’ => ‘rand’, offset not working
- Proper way to display latest 5 posts grouped by post type?
- Reset WordPress Post Query to default
- Author list based on recently active
- How to get excerpt of the recent posts
- List most recently added posts (with a twist)
- Recent posts on homepage
- link to single most recent post, regardless of category
- Most recent post is missing from Author page
- How to obtain the recent posts without their content in an efficient way?
- How to check if the current page is at a specified path in the URL?
- ‘Recent Posts’ links open in new window, without copying the ‘WP_Widget_Recent_Posts’ class
- Posts modified in the last 48 hours
- How to avoid duplicates when creating recent network posts
- Latest posts by category — how to exclude current post?
- Recent posts on homepage: different thumbnail based on logged in status and post category
- 2 column recent post query not respecting float right [closed]
- Display css ONLY on most recent post of specific category?
- Add hero image to home page (blog format) via the dashboard
- Exclude latest post from WP_Query taxonomy term loop
- Display recent posts on another site
- Get x recent posts by author?
- Problem with Front-Page.php loading recent posts
- How to show 3 most recent/viewed posts in a special tiles on home page using wordpress?
- Where to add offset?
- Manual excerpt length on recent posts slider
- Homepage custom recent news
- Offset Loop by 1 , Limit next loop to 1 (Most Recent) Post
- Show latest posts on responsive theme
- post preview/thumbnails not displaying correctly- linking to “home” instead of post?
- How do I add a small excerpt of a blog post on my Front Page Recent Posts widget?
- Import Recent Posts Only and Ignore old ones if exist
- add title to widgets of wordpress
- Cannot manage to display my CPT in Recent Posts widget
- Display Most Recent Post Widget Title On Page
- The styles in the recent posts widgets plugin not working
- Linking to the most recent post in my podcast category
- WordPress recent post
- Posts Per Page with a button to add more Posts
- Is it possible to show thumbnails along with recent post from a wordpress blog on static website’s homepage?
- How to filter wp_get_recent_posts() to only posts that have thumbnails?
- Showing wordpress latest post thumbnails in slider with auto increment
- Best way to add image to recent posts widget?
- How to add thumbnails from recent posts to owl-carousel in wordpress automatically?
- Recent Posts Widget URL / Domain change
- Recent post in the middle of the content
- Recent posts show thumbnail
- Autoblog posts in wpms(network) into main site including featured images
- Show all posts of all categories but excluding a category on custom blog page with pagination of my theme
- Have latest post and recent posts display differently
- Building Menus with the latest posts included
- Query recent posts by author
- Adjust layout most recent post, taking pagination into account
- how to show the most viewed, random and recent posts in the home?
- How to filter content by language with WPGlobus
- Recent posts with different class name for each post and a scrollbar?
- Recent posts with comment count in “Sidebar” template [closed]
- How to display Most Recently Read 10 Posts by a logged in user in wordpress
- How can I show second most recent post in sidebar, if most recent post is open in the browser?