How To Make A Gutenberg Block With Advanced Custom Fields - For Beginners

Поделиться
HTML-код
  • Опубликовано: 26 авг 2024

Комментарии • 69

  • @WPCasts
    @WPCasts  5 лет назад +9

    Reminder: To be able to create a "Block" you'll need the Advanced Custom Fields PRO plugin. Also, don't forget to subscribe!

    • @kensleylewis
      @kensleylewis 3 года назад +16

      Can you please update the title of your video with the word "Pro" at the end of the first line? This was a waist of 15 minutes of my life until I took time to read this first comment.

    • @grigoriymalyshev4782
      @grigoriymalyshev4782 3 года назад +2

      @@kensleylewis use Carbon Fields instead. It's absolutely free)

  • @kasio99
    @kasio99 Год назад

    You sir just changed my life forever thank you!

  • @paulmcclenaghan7108
    @paulmcclenaghan7108 4 года назад +1

    Really good tutorial, thanks! I tried another tutorial about 6 months ago which made this process seem so overly complicated that I gave up but I'm glad I came across this. I was able to get something going really quickly. I agree with you, it is a game-changer!

  • @dapowebdeveloper
    @dapowebdeveloper 9 месяцев назад

    Cool. ACF has improved and we now use Block.json and the registering of block function.

  • @peterkaltenberger6711
    @peterkaltenberger6711 3 года назад

    Thank You !!!!!! That's awesome :) Gutenberg Blocks to learn is a pain because of all the JavaScript. This is a great solution. You helped me a lot with this. I appreciate it :)

  • @robmcdonald7212
    @robmcdonald7212 5 лет назад +5

    Good tutorial, except I feel that you left out two important items. That being the block ID and the CSS for the block. The block ID is what makes each block unique and allows the block to be re-usable. And of course the CSS for styling the block.

    • @WPCasts
      @WPCasts  5 лет назад +2

      Thanks for bringing this up! In the next video that covers this I’ll make sure to circle back to those two topics! Cheers! 👍

  • @christiansmith188
    @christiansmith188 Год назад

    Thank you for this, exactly what i've been looking for.

  • @developerhasan2418
    @developerhasan2418 Год назад

    Excellent tutorial. Very easy to understand. Thanks

  • @user-ub7xo3qz2b
    @user-ub7xo3qz2b 5 лет назад +2

    This is exactly the tutorial I needed. Thank you!

  • @RanukaHerath
    @RanukaHerath 2 года назад

    This was exactly I needed. Thanks

  • @AlapJoshi-kc5zz
    @AlapJoshi-kc5zz 4 месяца назад

    Perfect for the new bee.

  • @PatrickCPrice
    @PatrickCPrice 4 года назад +1

    Yes great tutorial, but that changes adding content into ACF fields from the main working area (as it used to be, and still is for all other blocks), to adding the acf content to the right sidebar and only displaying the data in the content area? doesn't that like change / break the entire logic of adding content in the blocks themselves?

  • @that_marketing_chick
    @that_marketing_chick 3 месяца назад

    My toaster is not showing on the front end. Did you put any special settings in ACF? Can you share the source code please :)

  • @ashokrajpoot3785
    @ashokrajpoot3785 4 года назад

    Big thanks for making life easier. One request, can you add word file in the description with code for us. I am not that technical but good at copy paste..lol, it will add more value to the vides😀

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq Год назад

    hi, I just want my post to have one field of custom text which will be used for dynamic content, shall I use ACF or Custom Post Types?

  • @paulroos8517
    @paulroos8517 2 года назад

    Realy good tutorial, thanks!

  • @talfrei
    @talfrei 3 года назад

    Is this only for ACF Pro? I don't see Block in the standard version of ACF.

  • @AaronDayABD
    @AaronDayABD 2 года назад

    Freaking awesome, total game changer. Thanks for making this!

  • @errorerror1337
    @errorerror1337 3 года назад

    This is awesome! Thank you for the best video on how to do this!

    • @WPCasts
      @WPCasts  3 года назад

      You're very welcome!

  • @genxindia1154
    @genxindia1154 2 года назад

    You said something about a video where you talked about that table code? Please provide a link to it.

  • @positrone
    @positrone 5 лет назад +3

    Idea: create a custom post type for Blocks with ACF fields for Title, Icon, Template, Desc, Keywords
    and at acf init: loop through hese CPTs and register them.

    • @junglestar
      @junglestar 4 года назад

      Can you explain how you would do this further?

    • @atypical_blk_guy
      @atypical_blk_guy 4 года назад +1

      That's a good solution especially if you need repeater functionality but don't want to buy the premium version.
      What they mean is : create a custom post type "block" and then in the admin instead of choosing block, choose post type and select the name of your custom post type. Then add the fields you want. Go create a new "block" and you'll see the acf fields you created. What good about this option is you can use the loop to show your created blocks which will mimick a repeater.

  • @Thomas-mm5fr
    @Thomas-mm5fr 4 года назад +1

    How can I do if im want a "wrapper-block"? A template like:

  • @AslamD
    @AslamD 3 года назад

    This is amazing feature. Have been using ACF since many years now but didn't notice they launched this feature for Gutenberg. Best feature to say goodbye to Page builders :)
    Is it possible to put all the fields in left side area somewhere instead of right sidebar? That area is too narrow to fit all the fields.

  • @3dwebsites.
    @3dwebsites. 2 года назад

    Thank you

  • @13aaryan
    @13aaryan 4 года назад

    Thank you so much for the great video! I actually use Block Lab to create the blocks, but I've ACF installed as well, do you suggest I remake all blocks in ACF, or having both plugins is fine? Thank you so much!

  • @cliffordano3701
    @cliffordano3701 2 года назад

    Will this work with Kadence?

  • @quantum_leap
    @quantum_leap 3 года назад

    How would I add CSS for the block for use in the backend?

  • @nielfernandez8721
    @nielfernandez8721 2 года назад

    Cool! Thanks

  • @MrPanzerDragoon
    @MrPanzerDragoon 2 года назад

    Thank you x1000!

  • @vj-design
    @vj-design 4 года назад +1

    Fantastic Tut WPCasts. Is it possible to do this as a plugin rather than modify the theme? I wish to continue to have the functionality even if theme is swapped.

    • @WPCasts
      @WPCasts  4 года назад

      Yes! That is possible :)

    • @vj-design
      @vj-design 4 года назад +2

      Any thoughts on how that could be done? Can you please share some code or provide links to a tut?

    • @Allformyequine
      @Allformyequine 4 года назад

      @@vj-design Yes I agree we would LUV a tutorial as to how this can be done as a plugin!

  • @azizultex
    @azizultex 4 года назад

    Thanks for the cast. Is it possible to load block specific scripts only?

  • @schlotterich
    @schlotterich 4 года назад

    Thank you so much! This helped me so much. Will there be any more videos on this topic?

  • @danitk8888
    @danitk8888 3 года назад

    Has anyone been able to use the render_callback parameter properly? I pass a function that returns some html but it never outputs, neither frontend or backend. render_template works great though. The only problem with that is coupling my templates with acf functions which I would like to avoid

  • @lamboboi352
    @lamboboi352 5 лет назад +1

    My team and I are having some issues on trying to get the fields to display. We are trying to create a searchable database using the ACF plugin. Could you please help @WPcasts ? We’ll pay you for your time.

    • @WPCasts
      @WPCasts  5 лет назад +1

      Don't worry about that. Do you have a repository?

  • @errorerror1337
    @errorerror1337 5 лет назад

    Man, fantastic video!

    • @WPCasts
      @WPCasts  5 лет назад

      Thank you! I really appreciate it. I hope you learned something!

  • @pasizdobrekuce
    @pasizdobrekuce 4 года назад

    Hey Alex, great stuff here. Do you plan on doing more ACF tuts? What am i interested in particular is ACF speed. Recently I've discovered that get_post_meta is much faster than get_field. I mean ACF is great plugin, takes WP on another level. But ... if there is a lot of data coming from DB it just slows down response significantly. In some cases I've managed to work around it using IntersectionObserver() and ajax. But it seems to be an "overkill" in some cases. It'd be nice if you could show us how you deal with it. Tnx.

    • @WPCasts
      @WPCasts  4 года назад +1

      I typically just use get_field, however there is a case to be made for using get_post_meta instead. I wish there was a way to have all the ACF fields combined into a single meta field in JSON...

  • @Felix-og7pd
    @Felix-og7pd 2 года назад

    brilliant

  • @thaihoangtran
    @thaihoangtran 4 года назад

    How to show Gutenberg Block custom in tamplate custom?

  • @16ssc1988
    @16ssc1988 2 года назад

    any option ? dowload this code?

  • @jawfilife4
    @jawfilife4 4 года назад

    After creating this in the editor I cannot get the block to display on my page. Any Ideas?

    • @thaihoangtran
      @thaihoangtran 4 года назад

      Yes! Me too, I use in page but it only displays WP default block, and custom Block it does not show

  • @Unknown-mc2gs
    @Unknown-mc2gs 3 года назад

    Is there any other way that doesn't require coding?

  • @evanc8057
    @evanc8057 11 месяцев назад

    This helped me out but heads up there seems to be a newer (better) way to do this. This seems outdated.

  • @Labyrinthman
    @Labyrinthman 4 года назад

    This is the code I put in the functions.php yet I don't have the block showing up.
    What I'm I doing wrong?
    if(function_exists('acf_register_block_type')){
    add_action('acf/init','register_acf_block_types');
    }
    function register_acf_block_types(){
    acf_register_block_type(
    array(
    'name'=>'toaster',
    'title'=>__('Toaster'),
    'description'=>__('A custom toaster block'),
    'render_template'=>'template-parts/blocks/toaster/toaster.php',
    'icon'=>'editor-paste-text',
    'keywords'=>array('toaster','product')
    )
    );
    }

    • @balmoreramirez2212
      @balmoreramirez2212 2 года назад

      add_action('acf/init', 'my_acf_init_block_types');
      function my_acf_init_block_types()
      {
      // Check function exists.
      if (function_exists('acf_register_block_type')) {
      // register a testimonial block.
      acf_register_block_type(array(
      'name' => 'toaster',
      'title' => __('Toaster'),
      'description' => __('A custom toaster block'),
      'render_template' => 'template-parts/blocks/toaster/toaster.php',
      'icon' => 'editor-paste-text',
      'keywords' => array('toaster', 'product')
      ));
      }
      }

    • @tucado
      @tucado Год назад

      I have the same problem, everything should be OK, but it does not create a block. How come?

    • @Labyrinthman
      @Labyrinthman Год назад

      @@tucado Are you using ACF PRO?

    • @tucado
      @tucado Год назад +1

      @@Labyrinthman Thank you so much for your quick response. I simply mistyped something. It works like magic now. Thank you so much. I will share my code here if someone needs it.

  • @DelanoMyers
    @DelanoMyers 4 года назад

    which editor is this?

  • @k.b5033
    @k.b5033 4 года назад

    fr.wordpress.org/plugins/acf-extended/ for a best customisation of blocks

  • @HaifengZhu-pn3uq
    @HaifengZhu-pn3uq Год назад

    Advanced Fields seems complicated

  • @YeahNoTellTheTruth
    @YeahNoTellTheTruth 3 года назад +1

    The Repeater field type is not there in the Advanced Custom Fields plugin unless I pay ridiculous yearly fees to release it. What a misleading and wasting time video.