-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmetabox_basic.php
More file actions
293 lines (193 loc) · 9.58 KB
/
metabox_basic.php
File metadata and controls
293 lines (193 loc) · 9.58 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<?php
// Globals
global $post;
global $wpdb;
global $camp_general;
global $post_id;
global $camp_options;
global $post_types;
global $camp_post_author ;
global $camp_post_status;
global $camp_post_type;
global $camp_post_custom_k;
global $camp_post_custom_v;
?>
<div class="TTWForm-container" dir="ltr">
<div class="TTWForm">
<div class="panes">
<div id="field1zz-container" class="field f_100">
<label for="field1zz">
Post type
</label>
<select name="camp_post_type" id="field1zzz">
<?php
$post_types = get_post_types(array('public' => true));
foreach($post_types as $post_type){
echo '<option value="'.$post_type.'"';
wp_automatic_opt_selected($camp_post_type,$post_type);
echo '>'.$post_type ;
echo '</option>';
}
?>
</select>
</div>
<?php if ( class_exists( 'WooCommerce' ) ) { ?>
<div class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" value="OPT_SIMPLE" type="checkbox">
<span class="option-title">
Do not add the product as affiliate but as a simple product
</span>
</div>
</div>
<div class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" value="OPT_PRODUCT_EXTERNAL" type="checkbox">
<span class="option-title">
Add the product as external affiliate product
</span>
</div>
</div>
<?php } ?>
<div class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" data-controls="post_format_c" id="post_format_opt" value="OPT_FORMAT" type="checkbox">
<span class="option-title">
Custom post format ?
</span>
<br>
<div id="post_format_c" class="field f_100">
<label for="field6">
Post format name
</label>
<input value="<?php echo @$camp_general['cg_post_format'] ?>" name="cg_post_format" type="text">
</div>
</div>
</div>
<div class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" data-controls="post_parent_c" id="post_parent_opt" value="OPT_PARENT" type="checkbox">
<span class="option-title">
Set a parent page
</span>
<br>
<div id="post_parent_c" class="field f_100">
<label>
Parent page numeric ID
</label>
<input value="<?php echo @$camp_general['cg_post_parent'] ?>" name="cg_post_parent" type="text">
</div>
</div>
</div>
<?php if( function_exists('bbp_insert_topic') ){?>
<div class="field f_100">
<div class="option clearfix">
<input data-controls="BB_FORUME_c" name="camp_options[]" value="OPT_BB_FORUME" type="checkbox">
<span class="option-title">
Set bbPress forum ID
</span>
<br>
<div id="BB_FORUME_c" class="field f_100">
<label>Numeric forum ID</label> <input value="<?php echo @$camp_general['cg_bb_fid'] ?>" name="cg_bb_fid" type="text">
<div class="descripiton">Numeric ID appears at the address bar when editing the forum at the post parameters "post=NUMERIC_ID"<br><br>*Choose "topic" as the post type</div>
</div>
</div>
</div>
<?php } ?>
<div id="field1zzv-container" class="field f_100">
<label for="field1zzv">
Posts author
</label>
<?php wp_dropdown_users(array('name' => 'camp_post_author','selected'=>$camp_post_author , 'role__in' =>array( 'Administrator','Editor','Author','Contributor' ))); ?>
</div>
<div id="field1zz-container" class="field f_100">
<label for="field1zz">
New post status
</label>
<select name="camp_post_status" id="field1zz">
<option id="field1-1" value="draft" <?php @wp_automatic_opt_selected('draft',$camp_post_status) ?> >
Draft
</option>
<option id="field1-2" value="publish" <?php @wp_automatic_opt_selected('publish',$camp_post_status) ?> >
Published
</option>
<option value="private" <?php @wp_automatic_opt_selected('private',$camp_post_status) ?> >
Private
</option>
<option id="field1-2" value="pending" <?php @wp_automatic_opt_selected('pending',$camp_post_status) ?> >
Pending
</option>
</select>
</div>
<div class="field f_100">
<div class="option clearfix">
<input data-controls="alert_original_time" name="camp_options[]" value="OPT_DRAFT_PUBLISH" type="checkbox">
<span class="option-title">
Add the post as draft then publish after setting featured image/comments/tags <br>(Recommended for other plugins that works on publish)
</span>
<br>
<div id="alert_original_time" class="field f_100">
<span style="padding-left:20px;"><strong>Alert:</strong></span> Set post to its original time option will not work when this option is active</a>
</div>
</div>
</div>
<div class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" value="OPT_MUST_ENGLISH" type="checkbox">
<span class="option-title">
Set non English posts status as pending (Guessing)
</span>
<br>
</div>
</div>
<div id="custom_fields" class="field f_100">
<div class="option clearfix">
<input name="camp_options[]" id="cusom_fields_option" value="OPT_CUSTOM" type="checkbox">
<span class="option-title">
Add custom fields/Taxonomies to the posts
</span>
<br>
<div id="custom_fields_c" class="field f_100">
<div id="custom_fields_c_f">
<div style="margin-bottom:5px" class="supportedTags2"></div>
<button style="float:right" id="custom_new">+</button>
<?php
if(is_array($camp_post_custom_k) & count($camp_post_custom_k) >0 ){
$in=0;
$added=0;
foreach($camp_post_custom_k as $k){
if(trim($k) != ''){
$added=1;
?>
<div class="custom_field_wrap">Field Name <input style="width:100px" value="<?php echo $k ?>" name="camp_post_custom_k[]" class="no-unify">
value <input style="width:200px" value="<?php echo htmlentities($camp_post_custom_v[$in],ENT_COMPAT, 'UTF-8') ;?>" name="camp_post_custom_v[]" class="no-unify"><br> </div>
<?php
}
$in++;
}
if($added == 0){
?>
<div class="custom_field_wrap">Field Name <input style="width:100px" value="" name="camp_post_custom_k[]" class="no-unify">
value <input style="width:200px" value="" name="camp_post_custom_v[]" class="no-unify"><br> </div>
<?php
}
}else{
?>
<div class="custom_field_wrap">Field Name <input style="width:100px" value="" name="camp_post_custom_k[]" class="no-unify">
value <input style="width:200px" value="" name="camp_post_custom_v[]" class="no-unify"><br> </div>
<?php
}
?>
</div>
<div class="description"><br>*Prefix the field name with "taxonomy_" if you want the value to be added as a custom taxonomy ex "taxonomy_product_tag" adds the value to the taxonomy named product_tag
<?php if ( class_exists( 'WooCommerce' ) ) {
echo '<br><br>*Set the field name to "woo_gallery" if you want to set a product gallery from a rule that contains images <br><br>*Set the field name to "_price" if you want to set product price to an extracted value';
} ?>
</div>
</div><!-- div1 -->
</div><!-- div1 -->
</div> <!-- div1 -->
<div class="clear"></div>
</div>
</div>
</div>