How can I add thumbnails to front page code for the Recent Posts area?
-
I have a site that is not administered by WordPress but has a front page section that is managed by it. It is the Recent Posts area of the front page. I have got the post links to appear using the following code plugged into the relevant part of the page:
<div class="extras-blog"> <h4>RECENT POSTS</h4> <?php include('cp-blog/wp-load.php'); // Blog path // Get the last 'numberposts' posts $recent_posts = wp_get_recent_posts(array( 'numberposts' => 15, 'post_thumbnail' => thumbnail, 'post_type' => 'post', 'post_status' => 'publish' )); // Display them as list echo '<ul>'; foreach($recent_posts as $post) { echo '<li>? <a href="', get_permalink($post['ID']), '">', $post['post_title'], '</a></li>'; } echo '</ul>'; ?> </div>
How do I add code to also show the post thumbnail to the left of the link (the first image in the post)? If one clicks on one of the posts, one will get taken to the page where the post appears. One will be able to see the post list on the right (on laptops/computers) or below the post (on mobile devices). You’ll see the thumbnails there. But that’s because I have used a widget called ‘Recent Posts with Thumbnail’. When emailing the developer of that widget he said I could use the the_post_thumbnail() and get_the_post_thumbnail() code that is inherent in WP, but I don’t know how to implement it. Any help would be appreciated.
The page I need help with: [log in to see the link]
- The topic ‘How can I add thumbnails to front page code for the Recent Posts area?’ is closed to new replies.