<?php
if (!defined(‘ABSPATH’)) {
exit; // Exit if accessed directly.
}
/**
* Registers the block using the metadata loaded from the `block.json` file.
* Behind the scenes, it registers also all assets so they can be enqueued
* through the block editor in the corresponding context.
*
* @see https://developer.wordpress.org/reference/functions/register_block_type/
*/
function eventscalendar_co__block_init() {
register_block_type( __DIR__ . ‘/build’);
}
add_action( ‘init’, ‘eventscalendar_co__block_init’ );
function eventscalendar_co__editor_assets() {
add_theme_support(‘editor-styles’);
// “Google Fonts” key from events-calendar-dashboard-2
$fontListUrl = ‘https://www.googleapis.com/webfonts/v1/webfonts?sort=popularity&key=AIzaSyCCcby7HbDsq2lgYEQwfXkutFnsiHiTWHI’;
$response = wp_remote_get($fontListUrl);
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);