Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gutenberg solution #8

Open
xeux opened this issue Jul 8, 2021 · 0 comments
Open

Gutenberg solution #8

xeux opened this issue Jul 8, 2021 · 0 comments

Comments

@xeux
Copy link

xeux commented Jul 8, 2021

In case anyone needs to add Gutenbergs blocks to the plugin:

  1. Create the folder "Gutenbergs".
  2. Create a file inside: Gutenbergs_Loader.php
  3. Create a file inside: MyGutenberg.php
  4. Change Plugin.php file.

Gutenbergs_Loader.php content:

<?php

namespace VendorName\PluginName\Gutenbergs;
use VendorName\PluginName\Plugin;

class Gutenbergs_Loader extends Plugin
{
	public function __construct()
	{
		new MyGutenberg();
	}
}

MyGutenberg.php content:

<?php

namespace VendorName\PluginName\Gutenbergs;
use VendorName\PluginName\Plugin;
use Carbon_Fields\Block;
use Carbon_Fields\Field;

class MyGutenberg extends Plugin {

  public function __construct() {
CARBON FIELDS BLOCK CODE

  }
}

https://docs.carbonfields.net/learn/containers/gutenberg-blocks.html

Plugin.php content
// Load Gutenbergs new Gutenbergs\Gutenbergs_Loader(); at load_plugin()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant