So this is what i have on the controller side.
$args =[
'post_per_page' => -1,
'offset' => 0,
'orderby' => 'date',
'order' => 'ASC',
'post_type' => 'reviews'
];
$the_query = new \WP_Query($args);
$reviews = [];
if($the_query->post_count > 0)
{
$reviews = array_map(function ($reviews){
$name = get_the_title($reviews);
$content = get_the_content($reviews);
return (object)[
'name' => $name,
'content' => $content
];
}, $the_query->posts);
wp_reset_postdata();
}
return $reviews;
and this is on view
@foreach($reviews as $review)
<blockquote class="blockquote">
<p class="mb-0">{{$review -> content}}</p>
<footer class="blockquote-footer"><cite title="Source Title">{{$review -> name}}</cite></footer>
</blockquote>
@endforeach
The problem is that instead of showing the content from the review post type it shows the content from the page post type.
any idea on what I am doing wrong?