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
|
<?php
/** * Class Penci_Transition_Text */ class Penci_Transition_Text {
/** * Penci_Transition_Text constructor. */ public function __construct() { add_shortcode( 'pencilang', array( $this, 'penci_language' ) ); }
/** * Shortcode language * * @param $langs * * @return mixed */ public function penci_language( $langs ) { $current_lang = get_locale(); $current_lang = strtolower( $current_lang );
$output = ''; if ( isset( $langs[ $current_lang ] ) ) { $output = $langs[ $current_lang ]; } elseif ( isset( $langs['default'] ) ) { $output = $langs['default']; }
return $output; }
}
new Penci_Transition_Text;
|