With the advent of the new Options Pages, my first thought was that I could store website-related information that I frequently reuse throughout a site that could be changed in a central location. For examples, the address and phone number of the company for whom the website is being built.
With that in mind, I created an Options Page and then connected it to a field group consisting of some address fields, similar to what I’d do were I connecting a field group to a page or post. I then filled in those fields via the new option that had then appeared on the left-hand WP menu.
On a page made with Elementor, I then added a text field and attempted to link it to the ACF field. ACF came up in the list of possible fields, but the ‘key’ field is empty. In other words, there’s no connection of these ACF fields to Elementor.
Perhaps because this Options Pages feature is new, Elementor has no way to handle this yet.
If there’s a way to do this without necessarily using Options Pages, could someone direct me to instructions of how I’d go about it?
Thanks in advance for the help.
The Elementor option will only detect fields that are saved as part of the post that you are editing. For options pages or when you are getting ACF fields from anywhere other than the current post requires the use of shortcodes and supplying the post ID (in this case “options”). ACF has a shortcode that works for simple fields. You have to build your own shortcodes for complex fields.
Thanks for your response, John.
I had no idea that ACF supported the use of shortcodes!
Using this newly-gained knowledge from you, I understand that because I am getting the ACF fields from anywhere other than the current post (for me it would be one of many pages), then using a shortcode in the format [acf field="field_name" post_id="123"] should get me what I need, substituting the word ‘options’ rather than a post ID.
Because one of the field names in what I created was business_name, I’ve created this shortcode: [acf field="business_name" post_id="options"] and placed it within some plain text.
Using this within an Elementor text editor field doesn’t yield any result. Literally nothing appears on the front end other than the plain text preceding and after those square brackets.
What am I doing wrong?
I have figured out the solution to my problem, helped by a YT video that appeared yesterday and gave me some clues.
My original aim was to use some fields created on an Options Page with Elementor. After approaching ACF tech support and receiving a very cryptic and complex answer, most of which was unintelligible to me, I concluded that Elementor didn’t support the use of ACF Options Pages.
My backup plan was to then use shortcodes to achieve what I’d set out to do.
My folly was in creating a Group field in ACF and then putting those various subfields (e.g. business name, phone number) into that set. It didn’t work in Elementor and neither did the shortcodes.
In the end, remaking the Field Group with discrete (i.e. not Group) fields totally solved the problem. I can now use Elementor’s dynamic fields control and shortcodes, if I prefer!
Thank you for all of your help on this.
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!