|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Flynt Shortcodes |
|
5
|
|
|
*/ |
|
6
|
|
|
|
|
7
|
|
|
namespace Flynt\Shortcodes; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Current year |
|
11
|
|
|
*/ |
|
12
|
|
|
add_shortcode('year', function () { |
|
13
|
|
|
$year = date_i18n('Y'); |
|
14
|
|
|
return $year; |
|
15
|
|
|
}); |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Site Title |
|
19
|
|
|
*/ |
|
20
|
|
|
add_shortcode('sitetitle', function () { |
|
21
|
|
|
$blogname = get_bloginfo(false, 'name'); |
|
|
|
|
|
|
22
|
|
|
return $blogname; |
|
23
|
|
|
}); |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Tagline |
|
27
|
|
|
*/ |
|
28
|
|
|
add_shortcode('tagline', function () { |
|
29
|
|
|
$tagline = get_bloginfo(false, 'description'); |
|
|
|
|
|
|
30
|
|
|
return $tagline; |
|
31
|
|
|
}); |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Flynt Shortcode reference |
|
35
|
|
|
*/ |
|
36
|
|
|
function getShortcodeReference() |
|
37
|
|
|
{ |
|
38
|
|
|
return [ |
|
39
|
|
|
'label' => __('Shortcode Reference', 'flynt'), |
|
40
|
|
|
'name' => 'groupShortcodes', |
|
41
|
|
|
'instructions' => __('A Shortcode can generally be used inside text fields. It’s best practice to switch to text mode before inserting a shortcode inside the visual editor.', 'flynt'), |
|
42
|
|
|
'type' => 'group', |
|
43
|
|
|
'sub_fields' => [ |
|
44
|
|
|
[ |
|
45
|
|
|
'label' => __('Site Title (Website Name)', 'flynt'), |
|
46
|
|
|
'name' => 'messageShortcodeSiteTitle', |
|
47
|
|
|
'type' => 'message', |
|
48
|
|
|
'message' => '<code>[sitetitle]</code>', |
|
49
|
|
|
'new_lines' => 'wpautop', |
|
50
|
|
|
'esc_html' => 0, |
|
51
|
|
|
'wrapper' => [ |
|
52
|
|
|
'width' => 50 |
|
53
|
|
|
], |
|
54
|
|
|
], |
|
55
|
|
|
[ |
|
56
|
|
|
'label' => __('Tagline (Subtitle)', 'flynt'), |
|
57
|
|
|
'name' => 'messageShortcodeTagline', |
|
58
|
|
|
'type' => 'message', |
|
59
|
|
|
'message' => '<code>[tagline]</code>', |
|
60
|
|
|
'new_lines' => 'wpautop', |
|
61
|
|
|
'esc_html' => 0, |
|
62
|
|
|
'wrapper' => [ |
|
63
|
|
|
'width' => 50 |
|
64
|
|
|
], |
|
65
|
|
|
], |
|
66
|
|
|
[ |
|
67
|
|
|
'label' => __('Current Year', 'flynt'), |
|
68
|
|
|
'name' => 'messageShortcodeCurrentYear', |
|
69
|
|
|
'type' => 'message', |
|
70
|
|
|
'message' => '<code>[year]</code>', |
|
71
|
|
|
'new_lines' => 'wpautop', |
|
72
|
|
|
'esc_html' => 0, |
|
73
|
|
|
'wrapper' => [ |
|
74
|
|
|
'width' => 50 |
|
75
|
|
|
], |
|
76
|
|
|
], |
|
77
|
|
|
] |
|
78
|
|
|
]; |
|
79
|
|
|
} |
|
80
|
|
|
|