I register a simple method on my app/controllers/app.php file
public static function latestTestimonials()
{
$posts = new \WP_Query([
'post_type' => 'depoimento',
'posts_per_page' => '3'
]);
return $posts;
}
I call this method inside a partial blade file
Testing the return with @php(var_dump(App::latestTestimonials()))
show the object correctly. But when I try to run the loop:
@while(App::latestTestimonials()->have_posts()) @php(App::latestTestimonials()->the_post())
<div @php(post_class('col-sm-4'))>
...
</div>
@endwhile
@php(wp_reset_postdata())
debug.log report PHP Fatal error:
Allowed memory size of 134217728 bytes exhausted