Are you talking about (something like) this:
<?php
$args = array(
'numberposts' => 2,
);
$recent_posts = wp_get_recent_posts($args);
foreach ($recent_posts as $recent) {
?>
<li>
<a href="https://wordpress.stackexchange.com/questions/127441/<?php echo get_permalink($recent["ID']); ?>" title="<?php echo esc_attr($recent["post_title"]); ?>">
<?php echo $recent["post_title"]; ?>
</a> >
</li>
<?php
}
?>
If so, what was the problem?
Related Posts:
- Displaying post per day
- Guidance with The Loop for CMS
- Display only text to WordPress loop without loosing the text formatting
- Post from one loop in different containers?
- Custom Loop Pagination on WordPress
- delete an array element when its date expires
- User Defined order on get_categories?
- get understrap pagination to work with custom query
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Displaying Only Certain Tags in Loop
- When would you use $_post instead of $post?
- Way to display “Yesterday”, “Today”
- Must Use Plugin Causing Query Error
- Advanced Custom Fields: Post Object – Not returning data [closed]
- multiple if statements [closed]
- have_posts() execution failure
- How does the ternary operator work in the wordpress loop post?
- How can I add multiple ‘tax_query’ arrays via a loop?
- Blog posts repeat
- How to set variable, pass it to a partial file and remove it after?
- Can’t find infinite loop cause
- Widgets in the loop if active
- Get post id within comments loop
- Syntax error when I try to insert my loop into an unordered list? [closed]
- How to get post ID in a Page?
- Custom Pagination is Broken
- PHP Warning: strip_tags() expects parameter 1 to be string?
- Echo a shortcode div after every 3 posts
- How to overwrite orderby with add_query_var
- What file have I to create in my custom WordPress theme to show all the post belonging to a specific category?
- Last class on last headline?
- get_the_ID() in the footer returns wrong value
- Show ACF field with link to ultimate member profile/WordPress user profile below the post (single post layout)
- Only show first image in foreach loop
- How to get current post category details inside “loop”?
- How to pass current loop data into nested loop
- WP_Query multiple post results
- Convert Featured products loop into Recent products loop?
- Wpdb get->results to out the the month from the db
- Echoing a CSS class based on category of post in a list
- Infinite Loop – WP_Query
- Posts are not looping through correctly
- Limit tags shown in post
- Create Div Wrapper On 3rd Iteration Or When Query Loop Items Run Out
- Php code error in wordpress if else statements [closed]
- pagination broken – clicking next displays “page not found”
- Add class to every other posts using get_posts
- the_post(); prints out style text into my HTML?
- Wp Query : Order by distance lat,lon
- How to Add a cutsom slug to my custom author role
- How do I get pagination for get_posts() in WordPress or do I have to rewrite the whole code?
- Give ID to divs inside the loop
- Display articles with a different template in the home page | Solved |
- How to output the taxonomies that are assigned to each custom post?
- Check if current post in loop is last on current page
- Looping through dummy posts and showing them in the main index.php
- Custom Loop.php having a loop inside a loop
- ACF – Get ID of relationship field in flexible content
- WordPress Ajax filter: Create two loops for different output styles?
- How to display sticky post always at the top (before regular post) in wordpress?
- adding or removing endforeach; throws error!
- Return to the beginning of the results of a for loop
- How to count posts posts if they are in a separate content page?
- Adding PHP to an if else loop
- ACF background-color per post in a WordPress loop
- Advertisement in Loop Posts wordpress
- Thumbnail wouldn’t scale to size properly
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- Filter loop by ‘price’ with meta_query
- Adding custom PHP to existing loop in Genesis
- How to Pass Current Taxonomy Terms into new WP_Query?
- Problems with the WordPress loop [closed]
- Add div after every 4 posts then every 2 posts for a responsive loop
- WordPress while loop with aphabetic counting like one, two, three
- Retrieving specific images from Media Library
- Add post class in custom loop (WP_QUERY)
- Loop returns more items than exist?
- Modify category archive page loop on functions.php
- Custom Taxonomy Link Text Echo Name Not Slug
- WP_Post is not from correct array
- Adding unique marketing messages between certain products whilst using isotope/Infinite Scroll
- I want my wordpress loop to only display posts of the standard format
- Automatically create a loop for post ID
- Limit ads appearing more than three times
- Pagination on Custom Loop
- why is this content-template not showing any of my blog-entries?
- the_post_thumbnail unless video id is added
- Trying to display ads on only a third of posts in a loop. Keep getting Error 500?
- Custom single.php files for different post formats
- How to call the_author_meta and make it work?
- Troubleshooting “loopback requests that take too long”
- WordPress post pagination on custom template not working
- Implement “No related posts for this entry” into the loop?
- Excerpt all post content Content Same Size without word cutting off
- Options.php loop won’t show!
- Help with if/else loop [closed]
- How do I exclude the current post from the upcoming post query
- When a foreach loop is used multiple times in blocks, is there a way to ensure a variable always has a unique value?
- Custom theme on multisite has issues with standard loop output
- How to get the post title inside a custom block in a loop? block.js