I did think about going that route but wanted to double check is there is something like includeFirst on backend…
If all fail I will use this solution…
To the best of my knowledge there is no out-of-the-box solution to replicate the behavior of includeFirst outside of Blade. The logic it’s executing is very simple (“Does this file exist? If yes, load it; if not, load this other one”) so you could theoretically roll your own, but wrapping it in a secondary blade seems like a much simpler solution that leverages existing systems to me.
I just noticed that in this custom view('partials.content')->render() loop it does not pull my ACF field unless I put them in partial as get_field('somefield', get_the_ID() )
I mean I can leave it like this, but do you maybe know why is that ?
My complete look look like this
if ($selected_posts) {
ob_start();
while ($query->have_posts()) :
$query->the_post();
echo view('partials.content-ajaxloadmore')->render();
// echo $content;
endwhile;
wp_reset_postdata();
$block['featured_posts'] = ob_get_clean();
}