-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom-quote-zitat-service.php
More file actions
44 lines (39 loc) · 1.82 KB
/
random-quote-zitat-service.php
File metadata and controls
44 lines (39 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* Plugin Name: Random Quote from Zitat-Service
* Plugin URI: https://github.com/muhme/quote_wordpress
* Description: Displays a random quote from the collection of the user community zitat-service.de in German 🇩🇪, English 🇬🇧, Spanish 🇪🇸, Japanese 🇯🇵 or Ukrainian 🇺🇦.
* Requires at least: 6.1
* Tested up to: 6.9
* Requires PHP: 7.4
* Version: 1.4.3
* Author: Heiko Lübbe
* Author URI: https://www.heikol.de
* License: GPLv3
* License URI: https://raw.githubusercontent.com/muhme/quote_wordpress/main/LICENSE.txt
* Text Domain: random-quote-zitat-service
* Domain Path: /languages
*/
namespace RandomQuoteZitatService;
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/
* @see https://wordpress.stackexchange.com/a/407437/239194
*/
function block_init()
{
register_block_type(__DIR__ . "/build");
// load MO files for PHP
load_plugin_textdomain( 'random-quote-zitat-service', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
// load JSON files for JS - this is necessary to use a custom languages path
// generates the handle based on the block name and the field name
$script_handle = generate_block_asset_handle( 'random-quote-zitat-service/random-quote', 'editorScript' );
wp_set_script_translations( $script_handle, 'random-quote-zitat-service', plugin_dir_path( __FILE__ ) . 'languages' );
}
add_action("init", "RandomQuoteZitatService\block_init");