Very helpful and very clear! Will definitely be using, but more than anything, great learning experience because I finally understand what ACF blocks are. Yes! Deeper dive(s) into ACF blocks would be great!
Great video mate - you've got a great way of explaining things. A couple of things I'd love to see: 1) How to hardcode ACF fields in the plugin instead of pulling them from the UI (so they're self-contained in the plugin). 2) How can we allow users to set their own palette colors? I'm using ACF blocks as a replacement for flexible content and don't plan on using core blocks any time soon. So would the customizer still be the best way to handle global styles for my use case? Or is there a Gutenberg equivalent that will work just as well with ACF blocks?
Thanks! These are great ideas for future videos. 1) I'd look into ACF's "Local JSON" feature as the go-to way to store ACF files locally in your theme. www.advancedcustomfields.com/resources/local-json/ Also if you want to prevent your users from seeing the ACF admin screen, you can hide it from them: www.advancedcustomfields.com/resources/how-to-hide-acf-menu-from-clients/ 2) You can override the default colors in the ACF color picker: www.advancedcustomfields.com/resources/javascript-api/#filters-color_picker_args . I could imagine setting that up with a custom ACF options field or else pulling the color values directly from theme.json 🤔
@@BrianCoords Thanks! I've been planning to dig more into local JSON. Regarding 2 - the issue is that this theme + blocks combo will be used by multiple clients in the same industry. Which means the palette needs to be both changeable in the UI, and I want to provide some preset choices too. That's easy to do with something like Kirki but seems a lot more limited with the Gutenberg global styles panel. Unless there's a way of adding custom sections and controls to the GB global styles panel? I'm also not sure how I'd access GB global styles in ACF blocks and if they're just limited to client side things like CSS variables. Whereas getting customizer options anywhere in PHP is easy, and they can include more complex db-stored stuff like layout configs etc.
Carousels are always hard because they're interactive - there may be some block plugins that do it, I could even imagine it coming to core one day, but for now a custom block, like an ACF Block, is the best way,
@@BrianCoords Sorry I didn't explain what I mean and thanks for the reply. I mean is ASF outdated since Wordpress has introduced FSE and a complete blocks workflow? So we can develop natively without ACF? Basically is ACF becoming redundant?
@@taunado Oh I see. No I think there's always a great use case for ACF. It gives you a UI for things like custom fields and settings pages. If you aren't interested in learning React, you can build custom blocks with it very easily. There's still a lot of reasons a developer might want to use ACF.
Hi Brian, Thanks for the video. Is it possible to display woocommerce products in your carousel? I'm also researching if ACF can handle woocommerce native fields, but can't find any useful articles on the web...
Yeah that's a great question. Since WooCommerce products appear as a custom post type, you should be able to update the post/relationship field to load the "Products" CPT instead of just posts.
Thanks! If I remember correctly, I used wp-cli to generate the initial plugin for this one. Since I use LocalWP for local development, it has wp-cli built right in! I also probably deleted some of the stuff I didn't need, like the stuff for translation, the grunt file, etc. Here's a link: developer.wordpress.org/cli/commands/scaffold/plugin/
I downloaded your repo; everything worked, except for some minor css issues. I'm still wondering why I was getting "No posts selected"?? Maybe a naming issue somewhere...
I am running on the same issue and I am not getting a different post type. Just the native one. Any idea what could be the reason? (Thanks for this video)@@BrianCoords
Works great for the build, but I noticed its still loading the scripts and styles on other pages even if the block is not being used, any ideas why? Have followed the tutorial exactly Edit: I should mention this is on a custom theme, not the default WordPress theme. Its the only difference I can think of but surely this isn't why?
So there's a filter that determines whether your site will load ALL block assets or just the assets on the current page. It's typically true on block themes but not on custom themes. Take a look here and see if this helps: developer.wordpress.org/reference/hooks/should_load_separate_core_block_assets/
@@BrianCoords Actually I need to retrieve custom post type and it's post pages acf custom fields value to a acf block template and it was unable to retrieve at that time because of I didn't pass get_the_id(); function in a acf get_field('field key name', get_the_id); in a query loop. But now it's resolved.
Absolutely love your videos. keep up the good work.
Very helpful and very clear! Will definitely be using, but more than anything, great learning experience because I finally understand what ACF blocks are. Yes! Deeper dive(s) into ACF blocks would be great!
Sounds great! I have a few more ACF Blocks ideas on the way.
Very useful, thank you!
This video is golden. Hope you make more videos.
Thanks for watching!
Thank you so much. I was doing it the old way by using acf_register_block_type() but I will start to do the native approach.
Great video mate - you've got a great way of explaining things. A couple of things I'd love to see:
1) How to hardcode ACF fields in the plugin instead of pulling them from the UI (so they're self-contained in the plugin).
2) How can we allow users to set their own palette colors? I'm using ACF blocks as a replacement for flexible content and don't plan on using core blocks any time soon. So would the customizer still be the best way to handle global styles for my use case? Or is there a Gutenberg equivalent that will work just as well with ACF blocks?
Thanks! These are great ideas for future videos.
1) I'd look into ACF's "Local JSON" feature as the go-to way to store ACF files locally in your theme. www.advancedcustomfields.com/resources/local-json/
Also if you want to prevent your users from seeing the ACF admin screen, you can hide it from them: www.advancedcustomfields.com/resources/how-to-hide-acf-menu-from-clients/
2) You can override the default colors in the ACF color picker: www.advancedcustomfields.com/resources/javascript-api/#filters-color_picker_args . I could imagine setting that up with a custom ACF options field or else pulling the color values directly from theme.json 🤔
@@BrianCoords Thanks! I've been planning to dig more into local JSON.
Regarding 2 - the issue is that this theme + blocks combo will be used by multiple clients in the same industry. Which means the palette needs to be both changeable in the UI, and I want to provide some preset choices too. That's easy to do with something like Kirki but seems a lot more limited with the Gutenberg global styles panel. Unless there's a way of adding custom sections and controls to the GB global styles panel?
I'm also not sure how I'd access GB global styles in ACF blocks and if they're just limited to client side things like CSS variables. Whereas getting customizer options anywhere in PHP is easy, and they can include more complex db-stored stuff like layout configs etc.
Thanks. Is the new Wordpress FSE with blocks simpler to do this? Or is ACF approach still the way, if that even makes sense?
Carousels are always hard because they're interactive - there may be some block plugins that do it, I could even imagine it coming to core one day, but for now a custom block, like an ACF Block, is the best way,
@@BrianCoords Sorry I didn't explain what I mean and thanks for the reply. I mean is ASF outdated since Wordpress has introduced FSE and a complete blocks workflow? So we can develop natively without ACF? Basically is ACF becoming redundant?
@@taunado Oh I see. No I think there's always a great use case for ACF. It gives you a UI for things like custom fields and settings pages. If you aren't interested in learning React, you can build custom blocks with it very easily. There's still a lot of reasons a developer might want to use ACF.
@@BrianCoords Thanks! I've learned React, just got to learn PHP now.
Hi Brian, Thanks for the video. Is it possible to display woocommerce products in your carousel? I'm also researching if ACF can handle woocommerce native fields, but can't find any useful articles on the web...
Yeah that's a great question. Since WooCommerce products appear as a custom post type, you should be able to update the post/relationship field to load the "Products" CPT instead of just posts.
Hi mate, wonderful videos.
How do you "auto generate" the initial plugin files?
Thanks! If I remember correctly, I used wp-cli to generate the initial plugin for this one. Since I use LocalWP for local development, it has wp-cli built right in! I also probably deleted some of the stuff I didn't need, like the stuff for translation, the grunt file, etc. Here's a link: developer.wordpress.org/cli/commands/scaffold/plugin/
Thanks man 👍
Thank you for sharing this video. I get "No posts selected" when trying to preview. Do you have an idea where my error is?
I downloaded your repo; everything worked, except for some minor css issues. I'm still wondering why I was getting "No posts selected"?? Maybe a naming issue somewhere...
Hmm are you trying to get posts or are you trying to get a different post type?
I am running on the same issue and I am not getting a different post type. Just the native one. Any idea what could be the reason? (Thanks for this video)@@BrianCoords
Found the answer. The get_field() should reference the Field Name you entered when creating the ACF
In your ACF field or on the front end of your site? @@vincentagasen1368
Works great for the build, but I noticed its still loading the scripts and styles on other pages even if the block is not being used, any ideas why? Have followed the tutorial exactly
Edit: I should mention this is on a custom theme, not the default WordPress theme. Its the only difference I can think of but surely this isn't why?
So there's a filter that determines whether your site will load ALL block assets or just the assets on the current page. It's typically true on block themes but not on custom themes. Take a look here and see if this helps: developer.wordpress.org/reference/hooks/should_load_separate_core_block_assets/
Can you make a video on a different type of block with ACF and not so fast in pace do it so beginners can understand
I'm planning a longer series with more step-by-step basics. Let me know if there are any particular parts of ACF Blocks that you'd like me to cover
How to get custom post type in a acf block template
Can you explain what you're trying to accomplish?
@@BrianCoords Actually I need to retrieve custom post type and it's post pages acf custom fields value to a acf block template and it was unable to retrieve at that time because of I didn't pass get_the_id(); function in a acf get_field('field key name', get_the_id); in a query loop. But now it's resolved.
give link of where you are coping the code bro
]
The full code is linked in the description but let me know if I'm missing anything else: github.com/bacoords/example-acf-carousel-block