Using ACF in php include
-
I need two things:
1. I have a section of my website that needs to be use on multiple pages with the same content.
2. I have another section with the same requirement as above, but it is a reviews slider.
What I would like to do is store the markup for this, while having the content for this section be editable using ACF. I would like a central location to edit this sections content fields, and I would like to include the section to any page using shortcodes or php includes, or etc.
I tried using “reusable text blocks” and I can assign ACF fields to the blocks I create, but I cannot wrap these blocks in my markup. I can place all of my markup in text block and it will work, but it isn’t easily editable (non-developer friendly).
I thought about using a php include to add the global section to the templates that that they are needed on, but I don’t know how I would assign an ACF group to this file without making it a registered template. I don’t want to do this so the include file wouldn’t be editable.
I am really surprised that this isn’t a more common issue. Either 1. this is a non-issue and I am missing the solution, or 2. this isn’t possible…. I would really like any kind of information regarding this. I build my WP templates from scratch if that matters.
- The topic ‘Using ACF in php include’ is closed to new replies.