I can’t make the controller communicate with blade files. I’m out of ideas. If someone could give me a help that would be much appreciated. Below the settings I’m currently using this project and the files I changed:
“roots/sage-lib”: “~9.0.1”,
“soberwp/controller”: “~9.0.0-beta.4”
site/app/themes/my-theme/app/Controllers
App.php
AppHome.php
FrontPage.php
TemplateIndex.php
App.php
<?php
namespace App;
use Sober\Controller\Controller;
use Roots\Soil\Utils;
class App extends Controller {
public function listAwards()
{
$awards = new \WP_Query(array(
'post_type' => 'awards',
'posts_per_page' => '1',
));
$data = [];
while ($awards->have_posts()) {
$awards->the_post();
if (have_rows('awards_custom_field')) {
while (have_rows('awards_custom_field')) {
the_row();
$awards_list['title'] = get_sub_field('award_title');
$awards_list['years'] = get_sub_field('award_years');
array_push($awards_list, $data);
$awards_list = [];
}
}
}
return $data;
}
}
site/app/themes/my-theme/resources/views/layouts
app.blade.php
<!doctype html>
<html @php(language_attributes())>
@include(‘partials.head’)
<body @php(body_class())>
(…)
{!! $listAwards !!}