Giter Site home page Giter Site logo

acf-oik-blocks's Introduction

Herb Miller

  • I'm planning on retiring when I reach State Penson Age.
  • I'm working on reducing unnecessary tasks.
  • I'm in the process of closing down WP-a2z

I'm still working on a number of WordPress related projects

  • oik-ai - my AI tool

  • But I've reduced the list of plugins and themes that I'm currently working on

WordPress Full Site Editing themes:

  • SB - Second Byte: Seriously Bonkers' experimental Full Site Editing theme.
  • Written - An experimental FSE theme to replace Genesis-hm
  • tt4ai - Child theme of Twenty Twenty-Four for writing about AI

WordPress plugins:

  • oik-bwtrace - Debug trace for WordPress - improvements for performance measurements
  • SB-Chart-block - A single block plugin to display Charts from CSV content.
  • Slog - An addon to my oik-bwtrace plugin to analyse daily trace summary reports and compare results.
  • SB-field-block - Field block to edit and display post meta data.
  • oik-unloader - WordPress Must Use plugin to unload unnecessary plugins on demand
  • gbcptedit - Gutenberg Custom Post Type edit
  • field-block-for-acf-pro - ACF Field block

Updated 28th May 2024

acf-oik-blocks's People

Contributors

bobbingwide avatar

Watchers

 avatar

acf-oik-blocks's Issues

Try to develop a PayPal block using ACF-Pro and no JavaScript

At the WordPress Cambridge Meetup someone asked about developing blocks using PHP. I said that there are some solutions about. The one I'd tried was ACF-Pro, but it was a long time ago and I didn't get very far. We agreed that it would be a good subject for future meetups. I have a documented requirement to develop a block version of the PayPal shortcode. bobbingwide/oik#184

I could just go ahead and develop a version with JavaScript, bit it also makes sense to attempt to develop it using ACF-Pro's PHP based block solution.
While this will give me more experience with ACF-Pro, it's unlikely that I'll make ACF-Pro a dependency on oik.
So it's just a short term distraction for educational purposes.

Requirements

  • A block based equivalent of the TinyMCE dialog to create PayPal buttons
  • Making underlying use of the existing [paypal] shortcode logic from oik
  • Developed using ACF-Pro
  • and No JavaScript
  • Solution suitable for presenting at a meetup in 2022

Try to develop a Block Count block using ACF-Pro and no JavaScript

I've had an ACF-Pro licence since 10 November 2019. Other than what I'm writing up here I've done nothing with it since I first got it. My first attempt to do something was to create a block called block-count to display the Block Count.

This is how it works.

  • In response to the acf/init action it registers the Block Count block using acf_register_block_type().
  • The callback function acf_oik_blocks_callback(), echos the output
  • It calls get_field() for a field called _block_count.
  • This field is registered for the CPT called Plugin ( oik-plugins ).
  • The field is defined with Style Seamless (no metabox)
  • In s.b/wordpress I wrote some shortcodes and blocks to test this field for the oik-magnetic-poetry plugin.

Here's the HTML code for some of the oik-magnetic-poetry post
https://s.b/wordpress/oik-plugins/magnetic-poetry/

<!-- wp:paragraph -->
<p>Block count: [acf field=_block_count]</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>[bw_fields fields=_block_count ]</p>
<!-- /wp:paragraph -->

<!-- wp:acf/block-count {"id":"block_5dc84573ff9e5","name":"acf/block-count","data":{"_block_count":"4","__block_count":"field_5dc8302fb9fa3"},"align":"","mode":"preview"} /-->
  • The [acf] shortcode is provided by ACF https://www.advancedcustomfields.com/resources/shortcode/
  • The _block_count field is also registered using oik-fields
  • It's not however associated with oik-plugins.
  • But it can be displayed by [bw_fields].
  • The last block is the ACF block. Note the acf/ prefix has been added automatically.

On the front end it displays the same output for each of the 3 blocks.

Block count: 42

where 42 is the number entered in the seamless metabox

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.