Recoverable Fatal Error – Object of class WP_Post could not be converted to string

the_title doesn’t work that way:

the_title( $before, $after, $echo );

$before is the text that comes before the title, but you didn’t give it a string/text, you gave it a post object. Post objects aren’t strings, PHP doesn’t know what to do so it stops and prints an error instead.

For the_title to work, you need to setup the current postdata. Normally a standard loop does this by calling the_post on the query, but you’ve chosen to use get_posts instead.

This is what a standard post WP_Query post loop should look like:

$query = new WP_Query([ ... ]);
if ( $query->have_posts() ) {
    while( $query->have_posts() ) {
        $query->the_post();
        //.... display post here
    }
    wp_reset_postdata();
}