ACF Blocks Post Carousel Tutorial

Поділитися
Вставка
  • Опубліковано 5 жов 2024

КОМЕНТАРІ • 35

  • @demystifyingdev
    @demystifyingdev Рік тому

    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!

    • @BrianCoords
      @BrianCoords  Рік тому +1

      Sounds great! I have a few more ACF Blocks ideas on the way.

  • @xSalamz
    @xSalamz Рік тому

    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.

  • @yasershahian3134
    @yasershahian3134 7 місяців тому

    Absolutely love your videos. keep up the good work.

  • @tevfik7
    @tevfik7 Рік тому

    This video is golden. Hope you make more videos.

  • @umidjonzoxidov
    @umidjonzoxidov 4 місяці тому

    Very useful, thank you!

  • @binaryfire
    @binaryfire 5 місяців тому

    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?

    • @BrianCoords
      @BrianCoords  5 місяців тому +1

      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 🤔

    • @binaryfire
      @binaryfire 5 місяців тому

      ​@@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.

  • @ureckonsir8024
    @ureckonsir8024 Рік тому +1

    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

    • @BrianCoords
      @BrianCoords  Рік тому +1

      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

  • @faisalahammad
    @faisalahammad Рік тому

    Thanks man 👍

  • @davisvilums
    @davisvilums Рік тому

    Hi mate, wonderful videos.
    How do you "auto generate" the initial plugin files?

    • @BrianCoords
      @BrianCoords  Рік тому +1

      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/

  • @taunado
    @taunado 4 місяці тому

    Thanks. Is the new Wordpress FSE with blocks simpler to do this? Or is ACF approach still the way, if that even makes sense?

    • @BrianCoords
      @BrianCoords  4 місяці тому

      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,

    • @taunado
      @taunado 4 місяці тому

      @@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?

    • @BrianCoords
      @BrianCoords  4 місяці тому

      @@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.

    • @taunado
      @taunado 4 місяці тому

      @@BrianCoords Thanks! I've learned React, just got to learn PHP now.

  • @thebuildreview
    @thebuildreview Рік тому

    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...

    • @BrianCoords
      @BrianCoords  Рік тому

      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.

  • @mihirvaja3728
    @mihirvaja3728 10 місяців тому

    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?

    • @BrianCoords
      @BrianCoords  10 місяців тому +1

      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/

  • @bclaw
    @bclaw Рік тому

    Thank you for sharing this video. I get "No posts selected" when trying to preview. Do you have an idea where my error is?

    • @bclaw
      @bclaw Рік тому

      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...

    • @BrianCoords
      @BrianCoords  Рік тому

      Hmm are you trying to get posts or are you trying to get a different post type?

    • @vincentagasen1368
      @vincentagasen1368 8 місяців тому

      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

    • @vincentagasen1368
      @vincentagasen1368 8 місяців тому

      Found the answer. The get_field() should reference the Field Name you entered when creating the ACF

    • @BrianCoords
      @BrianCoords  8 місяців тому

      In your ACF field or on the front end of your site? @@vincentagasen1368

  • @coderpavan
    @coderpavan 28 днів тому

    How to get custom post type in a acf block template

    • @BrianCoords
      @BrianCoords  24 дні тому

      Can you explain what you're trying to accomplish?

    • @coderpavan
      @coderpavan 21 день тому

      @@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.

  • @ureckonsir8024
    @ureckonsir8024 Рік тому

    give link of where you are coping the code bro
    ]

    • @BrianCoords
      @BrianCoords  Рік тому

      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