Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PixxelTim opened this issue Aug 7, 2024 · 0 comments
Open

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

PixxelTim opened this issue Aug 7, 2024 · 0 comments

Comments

@PixxelTim
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant