Hi, that may be a noob question but I didn’t find answers in the forum so I need to ask. Sorry about that, really.
So I created a Composer called ‘Company’ with this code:
'<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class Company extends Composer
{
/**
* List of views served by this composer.
*
* @var string
*/
protected static $views = [
‘partials.content’,
];
/**
* Data to be passed to view before rendering, but after merging.
*
* @return array
*/
public function override()
{
return [
'title' => $this->title(),
];
}
/**
* Retrieve the post title.
*
* @return string
*/
public function title()
{
return get_the_title();
}
}’
And a content.blade with:
'<article @php(post_class())>
{{!! $title !!}}
</header>
<div class="entry-summary">
@php(the_excerpt())
</div>
'
And in my index file:
’ @while(have_posts()) @php(the_post())
@includeFirst([‘partials.content-’ . get_post_type(‘empresa’), ‘partials.content’])
@endwhile’
So I didn’t add any custom meta yet, but even with ‘empresa’ in the get_post_type I still get the normal posts (Hello World). Can somebody tell me what I’ve missed?