Hi, here’s an issue that’s giving me headaches since a couple of days.
I have a block which contains a component and that component includes a partial like this:
@includeFirst(['partials.content-' . get_post_type(), 'partials.content'])
I have also a composer in Composers/Product.php
with
protected static $views = [
'partials.content-single-product',
'partials.content-product',
];
The issue is that when the block is rendered, I don’t have any of the with()
variables instantiated inside my partial/content-product.php
and I can’t understand why.
Of course the setup_postdata()
is correctly called before the include, and WP functions (get_the_ID()
, get_field()
, etc.) work fine.
What am I doing wrong?
PS: the need for the block > component structure is to make a single component reusable either as a block (to use in WP editor) and as a component (to use in templates).