Log1x / sage-directives

A set of Blade directives for use with Roots Sage.
https://log1x.github.io/sage-directives-docs/
MIT License
284 stars 35 forks source link

Suggestion: Add directive to access post-related ACF fields #149

Open PixxelTim opened 3 months ago

PixxelTim commented 3 months ago

I would like to request a new feature for Sage Directives that enables direct access to ACF fields related to a specific post using a custom Blade directive.

Currently, to fetch and display an ACF field related to a specific post, one needs to use the get_field function within PHP blocks. For example: $customerName = get_field('projectKeyfacts', $project->ID)['projectCustomer']->post_title;

Given that $project already returns the post object, it would be beneficialto have a dedicated directive to simplify this process. @directive('fieldName', 'fieldKey', $post->ID)

If there are any considerations or alternative methods for achieving this functionality, I am open to suggestions. Thank you for considering this feature request.