WordPress Core Contributor, WordPress Kaunas Meetup co-organizer, WordCamp (Lithuania, Riga, Stockholm, Jyväskylä, Oslo, Norrköping) speaker and one of the editors of the Lithuanian WordPress translation team and co-host of Kodo Poetai podcast.
Free & premium WordPress plugin developer
Software Engineer at
deployer.seravo.com - a service that syncs WordPress plugins from GitHub to WordPress.org automatically.
TryoutWP.com - a service to spin up live temporary demo sites for WordPress plugins and themes.
add_filter( 'gutenfactory_blocks', 'my_awesome_block' );
function my_awesome_block( $blocks ) {
$blocks['arunas/my_awesome_block'] = [
'name' => 'My Awesome Block',
'category' => 'common',
'style' => plugins_url( 'my-awesome-block.css', __FILE__ ),
'editor_style' => plugins_url( 'my-awesome-block-editor.css', __FILE__ ),
'callback' => 'my_awesome_block_render',
'fields' => [
// define the fields here.
]
];
}
add_action('acf/init', 'my_register_blocks');
function my_register_blocks() {
// check function exists.
if( function_exists('acf_register_block_type') ) {
// Register a testimonial block.
acf_register_block_type(array(
'name' => 'testimonial',
'title' => __('Testimonial'),
'description' => __('A custom testimonial block.'),
'render_template' => 'template-parts/blocks/testimonial/testimonial.php',
'category' => 'formatting',
));
}
}
$banner = new StoutLogic\AcfBuilder\FieldsBuilder('banner');
$banner
->addText('title')
->addWysiwyg('content')
->addImage('background_image')
->setLocation('block', '==', 'acf/testimonial')
->or('block', '==', 'acf/anotherone');
add_action('acf/init', function() use ($banner) {
acf_add_local_field_group($banner->build());
});
if ( function_exists( 'lazyblocks' ) ) :
lazyblocks()->add_block( array(
'title' => 'Custom block',
'slug' => 'lazyblock/custom-block',
'supports' => array(
'html' => false,
'multiple' => true,
),
'controls' => array(
// define fields
),
'code' => array(
// editor/frontend templates or callbacks, assets
),
) );
endif;