-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
79 lines (72 loc) · 2.18 KB
/
index.php
File metadata and controls
79 lines (72 loc) · 2.18 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* Multilingual WordPress for developers
*
* Plugin Name: Multilingual WordPress for developers
* Version: 1.0.0
* Description: Companion plugin for my talk "Multilingual WordPress for developers" at various WordCamps.
* Author: Dennis Plötner
* Author URI: http://lloc.de/
* Text Domain: multilingual-wp4devs
* Domain Path: /languages/
* License: GPLv2 or later
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @copyright Copyright (C) 2025, Dennis Plötner, re@lloc.de
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 or later
* @wordpress-plugin
* @package Multilingual4Devs
*/
declare(strict_types=1);
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require __DIR__ . '/vendor/autoload.php';
}
/**
* The hook 'init' should be used to load the plugin's translation files.
*
* Don't use 'plugins_loaded' since it will create a warning!
*/
add_action(
'init',
static function () {
load_plugin_textdomain(
'multilingual-wp4devs',
false,
__DIR__ . '/languages'
);
wp_register_script(
'multilingual-wp4devs-script',
plugins_url( 'js/index.js', __FILE__ ),
array( 'wp-blocks', 'react', 'wp-i18n', 'wp-block-editor' ),
'1.0.0',
true
);
register_block_type(
'lloc/multilingual-wp4devs',
array(
'api_version' => 3,
'editor_script' => 'multilingual-wp4devs-script',
)
);
wp_set_script_translations(
'multilingual-wp4devs-script',
'multilingual-wp4devs',
plugin_dir_path( __FILE__ ) . 'languages'
);
}
);