I am trying to make a theme with ACF and Sage 10-beta.2
For some reason, I have some troubles with setting a variable from ACF when I’m using the Blade-syntax. It took me some time to figure out that if I use <?php instead of @php, everything worked.
What does “doesn’t work” mean? Is there an error? Is there no output?
Is there a reason why you’re trying to define a variable in the view instead of defining it from a view composer? Regardless, I’m not sure why the php directive isn’t working as expected for you, this works fine for me:
If this is just a snippet from the whole doc, there may be a chance you’ve used the @php( ... ) shorthand for @php and @endphp if I recall correctly you cannot mix these forms, you must always use @php() or always @php and @endphp
You can check your compiled view for confirmation of what was produced.
omg. You were right! I just discovered that there was a @while (have_posts()) @php(the_post())
I am sorry for posting this issue. Thank you for pointing me in the right direction.