-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
readme.txt
136 lines (86 loc) · 2.52 KB
/
readme.txt
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
=== Date Range for Ninja Forms ===
Contributors: PerS
Donate link: https://soderlind.no/donate/
Tags: date
Requires at least: 5.4
Tested up to: 5.7
Stable tag: trunk
Requires PHP: 7.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Add a Date Range field to Ninja Forms.
== Description ==
Add a Date Range field to your Ninja Forms.
== Filters ==
Add the filters to your child theme functions.php
= `date_range_lang` =
Override the value returned from get_locale().
E.g. if using Polylang, add:
`
add_filter( 'date_range_lang', function( $locale ) {
if ( function_exists( 'pll_current_language' ) ) {
$locale = pll_current_language( 'locale' );
}
return $locale;
} );
`
= `date_range_dropdowns` =
Enable dropdowns for months, years.
If `maxYear` is `null` then `maxYear` will be equal to `(new Date()).getFullYear()`.
`
add_filter( 'date_range_dropdowns', function( $dropdowns ) {
$dropdowns = [
'minYear' => 2020,
'maxYear' => 2030,
'months' => false,
'years' => true, // show dropdown for years.
];
return $dropdowns;
} );
`
= `date_range_buttontext` =
Text for buttons.
`
add_filter( 'date_range_buttontext', function( $buttontext ) {
$buttontext = [
'apply' => 'Apply',
'cancel' => 'Cancel',
'previousMonth' => '<svg .../></svg>',
'nextMonth' => '<svg .../></svg>',
];
return $buttontext;
} );
`
== Installation ==
1. Upload the plugin files to the `/wp-content/plugins/data-range-ninja-forms` directory, or install the plugin through the WordPress plugins screen directly.
1. Activate the plugin through the 'Plugins' screen in WordPress
1. Use Ninja Forms to add the Date Range field.
== Screenshots ==
1. Settings.
2. Using Ninja Forms to add the Date Range field.
3. Date Range at the front-end.
== Changelog ==
= 1.1.0 =
* Update to latest version of [Litepicker](https://github.com/wakirin/Litepicker)
= 1.0.2 =
* Lint source code using PHP CodeSniffer and [Rome](https://rome.tools/).
= 1.0.1 =
* Add date setting field.
= 1.0.0 =
* Refactor
= 0.0.7 =
* Refactor JavaScript to ES6.
= 0.0.6 =
* Fix breaking bug
= 0.0.5 =
* Add more settings.
* Add [filters](#filters): `date_range_lang`, `date_range_dropdowns` and `date_range_buttontext`.
* Add `languages/date-range-ninja-forms.pot`
= 0.0.4 =
* Replace Lightpick, no longer maintained, with [Litepicker](https://github.com/wakirin/Litepicker)
= 0.0.3 =
* In Ninja Forms builder, select WP Settings date.
= 0.0.2 =
* Set date format in Ninja Form builder
= 0.0.1 =
* Initial release.