-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsge-language-switcher.php
63 lines (56 loc) · 1.63 KB
/
vsge-language-switcher.php
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
<?php
/**
* Plugin Name: VSGE Language Switcher
* Description: A Plugin that provides the language switcher block for polylang
* Version: 0.4.2
* Requires at least: 5.8
* Tested up to: 6.5
* Requires PHP: 7.1.0
* Author: codekraft
* Author URI: https://codekraft.it
* License: GPL v3 or later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: vsge-language-switcher
* Domain Path: languages/
*/
define( 'VLS_PLUGIN_DIR', __DIR__ );
define( 'VLS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'VLS_NAMESPACE', 'vsge' );
if ( ! defined( 'VLS_REGIONS' ) ) {
define( 'VLS_REGIONS', array(
'europe' => array(
'europe' => 'Europe',
'gb' => 'United Kingdom',
'fr' => 'France',
'de' => 'Germany',
),
'middle_east_africa' => 'Middle East / Africa',
'asia_pacific' => 'Asia / Pacific',
'americas' => 'Americas',
) );
}
/**
* Adding actions to the init hook.
*/
add_action(
'plugins_loaded',
function() {
load_plugin_textdomain( 'vsge-language-switcher', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
);
/**
* Set the language cookie expiration to "Session"
*/
add_filter( 'pll_cookie_expiration', function() { return 'Session'; } );
/**
* Include the render callback and functions
*/
include_once VLS_PLUGIN_DIR . '/inc/functions.php';
include_once VLS_PLUGIN_DIR . '/inc/enqueue.php';
/**
* Register the block by passing the location of block.json to register_block_type.
*/
add_action( 'init', 'register_blocks' );
function register_blocks() {
register_block_type( dirname(__FILE__) . '/build' );
}