A collection of notes and emails from Jay about our block building system and how it is set up.

So far, we are using localwp to host a local version of a client’s site, then we edit locally and make a Duplicator backup and upload it to the client’s server. We try to avoid duplicating the entire wp_content database.

Here’s how to update carbon-fields on Safetell (with massive help from Jay):

That fixes the block editor not showing up when wordpress has been updated.

Inside  the folder at the root of the theme open “composer.json” and update the version number from:

"htmlburger/carbon-fields-plugin": "^3.3"  

to:

"htmlburger/carbon-fields": "^3.6"  

Inside the folder at the root of the theme go to vendor\htmlburger and replace the carbon-fields folder with this one.

Warning

For now though, that causes issues with the products slider, where it throws a bunch of errors. Jay will look at that soon.

Here’s how Jay describes the process for making new blocks:

In terms of adding new blocks it’s been a while but I believe the process was..

Create a folder inside the parts folder with the name of the block as the folder name.

Inside that folder create 2 files fields.php and part.php

fields.php is the fields of the block, fields are created via the $gbcCF variable (using misc-anchor as the example) all fields can be found at https://docs.carbonfields.net/learn/fields

fields.php example:

<?php
 
$gbcCF->create_component('Misc Anchor', [
    'Anchor Name' => [
        'type' => 'text'
    ],
]);

The fields are then automatically passed to the part.php and can be accessed via the $args array with the key being the sanitised version of the field name so in this case the Anchor Name field is accessed via:

$args[‘anchor-name’]

part.php example:

<div id="<?php echo sanitize_title($args['anchor-name']); ?>"></div>

The grid system being used is in layout.scss but will probably need looking over to understand how it works, it’s based off bootstrap so if you’ve used that you’ll be fine.