HOW TO: Add Custom Block to Child Theme
-
Hello guys,
after a deep search through Google and a lot of coding I got the solution for adding a custom Block to Aqua Page Builder in a WordPress Child Theme.
For this tutorial You must already have a child theme installed in WordPress. If you dont have one, just ask Google. There are dovens of tutorials.
Add following Code to your “functions.php” in the CHILD THEME:
require_once(get_template_directory() . '/pagebuilder/page-builder.php'); require_once(get_template_directory() . '/pagebuilder/classes/class-block.php'); require_once(get_stylesheet_directory() . '/pagebuilder/blocks/my_custom_block.php'); register_block('my_custom_block');
ATTENTION!! The argument my_custom_block MUST be the name of the Class in your custom block!
You have to check the folder names with the names of your WordPress installation! What does this code? It loads the default pagebuilder and all nessesary classes. In the second step it loads your custom block and registers this block.
For the content of your custom block element just study the default blocks. They contain a lot of interesting code you can use.
I hope I saved you a lot of time!
- The topic ‘HOW TO: Add Custom Block to Child Theme’ is closed to new replies.