feature post
Coding Tips PHP WordPress

How to Create Breaking Post with feature image on WordPress Site Code Example:

WordPress is a free and open-source content management system written in PHP and paired with a MySQL or MariaDB database.

<?php
$recent_posts = wp_get_recent_posts(array(
‘numberposts’ => 2, // Number of recent posts thumbnails to display
‘post_status’ => ‘publish’ // Show only the published posts
));
foreach($recent_posts as $post) : ?>

<center> <a href=”<?php echo get_permalink($post[‘ID’]) ?>”>
<h2 class=”entry-title”><?php echo $post[‘post_title’] ?></h2>
<?php echo get_the_post_thumbnail($post[‘ID’], ‘full’); ?>

</a></center>

<?php endforeach; wp_reset_query(); ?>

output

output

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.