diff --git a/gulpfile.js b/gulpfile.js index 8e1690f..6aff49f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,7 +14,9 @@ var scss_paths = [ 'inc/blocks/bfs-course-tax/assets/scss/**/*.scss', 'inc/blocks/bfs-course-lesson/assets/scss/**/*.scss', 'inc/blocks/bfs-course-time/assets/scss/**/*.scss', - 'inc/blocks/bfs-login/assets/scss/**/*.scss' + 'inc/blocks/bfs-login/assets/scss/**/*.scss', + 'inc/blocks/bfs-list-course-category/assets/scss/**/*.scss' + ]; /** SCSS */ diff --git a/inc/blocks/bfs-list-course-category/assets/json/block.json b/inc/blocks/bfs-list-course-category/assets/json/block.json new file mode 100644 index 0000000..a745a0a --- /dev/null +++ b/inc/blocks/bfs-list-course-category/assets/json/block.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://schemas.wp.org/trunk/block.json", + "name": "beflex/list-course-category", + "title": "BFS List Course Category", + "description": "", + "style": [ "block-bfs-list-course-category-style" ], + "viewScript": [], + "category": "beflex", + "icon": "", + "apiVersion": 2, + "textdomain": "beflex", + "keywords": [ + "beflex", + "bfs", + "list-course-category" + ], + "supports": { + }, + "acf": { + "mode": "auto", + "renderTemplate": "../../view.php" + } +} diff --git a/inc/blocks/bfs-list-course-category/assets/scss/style.scss b/inc/blocks/bfs-list-course-category/assets/scss/style.scss new file mode 100644 index 0000000..9a338e6 --- /dev/null +++ b/inc/blocks/bfs-list-course-category/assets/scss/style.scss @@ -0,0 +1,3 @@ +/** + * Style CSS de bfs-list-course-category +*/ \ No newline at end of file diff --git a/inc/blocks/bfs-list-course-category/bfs-list-course-category.php b/inc/blocks/bfs-list-course-category/bfs-list-course-category.php new file mode 100644 index 0000000..9c04dbd --- /dev/null +++ b/inc/blocks/bfs-list-course-category/bfs-list-course-category.php @@ -0,0 +1,41 @@ + + * @link https://developer.wordpress.org/themes/basics/theme-functions/ + * @since 4.0.0 + * @package beflex-child + * + */ + +if ( ! defined( 'BFS_LIST_COURSE_CATEGORY_DIR' ) ) { + define( 'BFS_LIST_COURSE_CATEGORY_DIR', dirname(__DIR__, 1) . '/bfs-list-course-category' ); +} +if ( ! defined( 'BFS_LIST_COURSE_CATEGORY_URL' ) ) { + define( 'BFS_LIST_COURSE_CATEGORY_URL', get_template_directory_uri() . '/inc/blocks/bfs-list-course-category' ); +} + +/** + * Generate block + * + * @return void + */ +function bfs_list_course_category_register_acf_blocks() { + wp_register_style( 'block-bfs-list-course-category-style', BFS_LIST_COURSE_CATEGORY_URL . '/assets/css/style.min.css' ); + register_block_type( BFS_LIST_COURSE_CATEGORY_DIR . '/assets/json/' ); +} +add_action( 'init', 'bfs_list_course_category_register_acf_blocks', 5 ); + +/** + * Load Json fields + * + * @param array $paths Json path + * + * @return array $paths Json path + */ +function bfs_list_course_category_load_json( $paths ) { + $paths[] = BFS_LIST_COURSE_CATEGORY_DIR . '/assets/json'; + return $paths; +} +add_filter( 'acf/settings/load_json', 'bfs_list_course_category_load_json' ); diff --git a/inc/blocks/bfs-list-course-category/view.php b/inc/blocks/bfs-list-course-category/view.php new file mode 100644 index 0000000..9e7747f --- /dev/null +++ b/inc/blocks/bfs-list-course-category/view.php @@ -0,0 +1,38 @@ + + +