@public #php #wordpress #wp #theme #recentposts

<?php
    $recent_posts = wp_get_recent_posts( array( 'numberposts' => '15' ) );
    foreach( $recent_posts as $recent ){
        if($recent["post_status"]=="publish"){
          /** any code you want to do with a post **/
        }
    }
?>