build
1 day ago
includes
1 day ago
multiple-blocks.php
1 day ago
package.json
1 day ago
webpack.config.js
1 day ago
multiple-blocks.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: FAPI Member |
| 4 | * Description: FAPI Member block and extensions. |
| 5 | * Requires at least: 5.8 |
| 6 | * Requires PHP: 5.6 |
| 7 | * Version: 0.1.2 |
| 8 | * Author: FAPI Business s.r.o. |
| 9 | * License: GPL-2.0-or-later |
| 10 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 11 | * Text Domain: fapi-member |
| 12 | * |
| 13 | * @package fapi-member |
| 14 | */ |
| 15 | |
| 16 | function create_block_fapi_member_block_init() { |
| 17 | |
| 18 | $blocks = array( |
| 19 | 'block-extender/', |
| 20 | 'fapi-form-block/', |
| 21 | ); |
| 22 | |
| 23 | foreach( $blocks as $block ) { |
| 24 | register_block_type( __DIR__ . '/includes/block-editor/blocks/' . $block ); |
| 25 | } |
| 26 | } |
| 27 | add_action( 'init', 'create_block_fapi_member_block_init' ); |
| 28 | |
| 29 | function register_fapi_category( $categories ) { |
| 30 | |
| 31 | $categories[] = array( |
| 32 | 'slug' => 'fapi', |
| 33 | 'title' => __('FAPI', 'fapi-member') |
| 34 | ); |
| 35 | |
| 36 | return $categories; |
| 37 | } |
| 38 | |
| 39 | if ( version_compare( get_bloginfo( 'version' ), '5.8', '>=' ) ) { |
| 40 | add_filter( 'block_categories_all', 'register_fapi_category' ); |
| 41 | } else { |
| 42 | add_filter( 'block_categories', 'register_fapi_category' ); |
| 43 | } |
| 44 |