Giter Site home page Giter Site logo

Comments (5)

bobbingwide avatar bobbingwide commented on July 19, 2024

Closing this now. I tried and succeeded.

from acf-oik-blocks.

bobbingwide avatar bobbingwide commented on July 19, 2024

image

With ACF PRO v6.1.6 the HTML for the acf/block-count block is simpler

<!-- wp:acf/block-count {"name":"acf/block-count","data":{},"mode":"preview"} /-->
  • data is now an empty array
  • align defaults to null so the attribute isn't set

image

When the value is changed in the seamless metabox, the block count doesn't update automatically.
You need to choose Update then view the post.
Different versions of Preview don't pick up the change, since it's not yet been applied in the server.

from acf-oik-blocks.

bobbingwide avatar bobbingwide commented on July 19, 2024

When I changed the Field Groups Settings so that the block count could be edited within the block
image

then the value entered ( 33 ) didn't override the value stored in meta data ( 42 ).

<!-- wp:acf/block-count {"name":"acf/block-count","data":{"field_5dc8302fb9fa3":"33"},"mode":"edit"} /-->

I'll need to read the docs. The original code just accesses the post meta data using get_field()

function acf_oik_blocks_callback( $block, $content, $is_preview, $post_id  ) {
	bw_trace2();
	echo "Block count: ";
	$block_count = get_field( '_block_count', $post_id );
	echo $block_count;
}

from acf-oik-blocks.

bobbingwide avatar bobbingwide commented on July 19, 2024

Since ACF PRO 6.0 block.json became the recommended way of registering blocks - matching the native WordPress registration methods.

See https://www.advancedcustomfields.com/resources/blocks/

We should update the code to register this block using this method.
See also https://www.advancedcustomfields.com/resources/acf-blocks-with-block-json/

from acf-oik-blocks.

bobbingwide avatar bobbingwide commented on July 19, 2024

Additional blocks to register are:

block name rendering method function / file
acf/block-count-2 renderCallback acf_oik_blocks_callback
acf-oik-blocks/block-count-3 renderTemplate block-count-3.php

from acf-oik-blocks.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.