1. Go to this page and download the library: Download juvo/wp-block-bridge library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
juvo / wp-block-bridge example snippets
use juvo\WP_Block_Bridge\Block_Bridge;
// Get context and attributes - works everywhere
$context = Block_Bridge::context( $block ?? null );
$attributes = Block_Bridge::attributes( $block ?? null );
// Your block markup...
ob_start();
use juvo\WP_Block_Bridge\Block_Bridge;
class My_Bricks_Element extends \Bricks\Element {
public function render(): void {
Block_Bridge::render_block(
'my-plugin/my-block',
__DIR__ . '/render.php',
[ 'postId' => get_the_ID() ]
);
}
}
use juvo\WP_Block_Bridge\Block_Bridge;
class My_Elementor_Widget extends \Elementor\Widget_Base {
protected function render(): void {
Block_Bridge::render_block(
'my-plugin/my-block',
__DIR__ . '/render.php',
[ 'postId' => get_the_ID() ]
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.