Site logo

Archived topic

Generateblocks and ACF

13 replies · Started by Marcel on February 19, 2020

Viewing posts 1–14 of 14

First of all, I want to congratulate you on the launch of the Generateblocks plugin, the whole community has been looking forward to this. I'm sure it will be very successful.
However, I would like to ask you, if I could integrate some custom fields, made with ACF Pro plugin, into the blocks made with Generateblocks. Unfortunately, using shortcodes only works for simple text-based values. I would need all kind of values, not just text.
I would be very happy if there was any such integration, otherwise, I would have to use the ACF blocks, but it would be more work, in the sense of customization from a visual point of view.
Thank you and wish you much success with Generateblocks!

Hi there,

What kind of integration are you looking for, exactly? What would those custom fields output? In which of our blocks?

I appreciate the feedback! :)

The idea would be to get the values added on ACF fields and place them on the Generateblocks' blocks. It is something similar to how Elementor uses ACF fields values. This kind of integration I was looking for, but it seems to be complicated.

Now I can use the ACF Blocks feature to achieve this.

Here's an example I'm currently trying to figure out.

I have two custom fields the client can edit:

    phone_number_dialer (text)
    phone_number_display (text)

Ideally, I can use a GB Headline block set to Paragraph, and edit the HTML to do this:

<a href='tel:[acf field="phone_number_dialer"]'>[acf field="phone_number_display"]</a>

When I try that now, the GB block converts my single quotes for the href into double and converts the double-quotes inside the brackets into &quot;. Escaping them inside brackets doesn't seem to work.

That did the trick! Thanks, David.

Glad to be of help

This seems like it would be useful when coupled with something like our Elements module, but not too useful otherwise. Am I right?

In the next version of GP Premium, we're adding dynamic fields to GenerateBlocks inside our Block Elements.

That was my intent, but I think it's useful anywhere site-wide data is needed.

For example, I created Site Header and Footer blocks (Elements), and wanted them to display the client's contact details (phone, email, region) across the site.

My mistake was adding custom fields (with ACF) to the Elements themselves and expecting them to be displayed throughout the site. (Post ID's/queries would be different from the Element posts, so the custom field data wouldn't be available anywhere else. Lesson learned.)

After more reading, I discovered ACF options pages, and created one for the contact details. Then, with David's helpful link, I created a shortcode to query and return data from the options page, and placed that shortcode in my site header and footer Elements.

It's kind of hacked together, but accomplishes what I wanted: one central place for my non-tech savvy client to update their contact information so it's automatically updated site-wide. Now the site header, site footer, and their Contact page are automatically updated without them touching page or Element/block content directly.

Super glad to hear this is coming to GPP!

Ah yes, the next version of GPP will make this much easier! We're almost ready for public testing :)

Will there be a link for public testing? I have a project where I created several shortcodes to get around this kind of issue. Would love to solve this in GP/GB without additional shortcodes.

Hi Tom,

I would like to be able to add acf field as an option to Generateblocks.
My field is a select field with diffrent colors which I just accross the website (also I am adding new colors there - I use clone option form acf).
The best would be if I can add this select box as a class to container or replace field add custom class(es) which standart ist input.

Is it possble to achieve it?

Thanks

Hi there,

this topic should be for the GB Support Forum or better still raised in the GB Community Forum:

https://community.generateblocks.com

If you can raise a topic over there and explain a little more of how this is being used we can take a look

This archived topic is closed to new replies.