-
Notifications
You must be signed in to change notification settings - Fork 0
/
smartcrawl-htpv.php
153 lines (141 loc) · 6.12 KB
/
smartcrawl-htpv.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
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
<?php
/*
Plugin Name: Smartcrawl HowTo Property Values
Plugin URI: https://mwale.me/
Description: This plugin adds custom fields to WordPress. You can use the custom fields to add schema information to your HowTo posts in Smartcrawl SEO plugin.
Version: 0.1
Author: Mwale Kalenga
Author URI: https://mwale.me/
*/
add_filter( 'rwmb_meta_boxes', 'm5_register_meta_boxes' );
function m5_register_meta_boxes( $meta_boxes ) {
$prefix = 'm5_';
$htpv_items = [
[
'type' => 'text',
'name' => esc_html__( 'Total Time', 'smartcrawl-htpv' ),
'id' => $prefix . 'total_time',
'desc' => esc_html__( 'The total time required to perform all instructions or directions (including time to prepare the supplies), in ISO 8601 duration format.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'PT1H30M', 'smartcrawl-htpv' ),
],
[
'type' => 'divider',
],
[
'type' => 'text',
'name' => esc_html__( 'Image', 'smartcrawl-htpv' ),
'id' => $prefix . 'image',
'desc' => esc_html__( 'Image of the completed how-to. Images must be in .jpg, .png, or. gif format.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'https://example.com/wp-content/uploads/2022/01/photo.jpg', 'smartcrawl-htpv' ),
],
[
'type' => 'divider',
],
[
'type' => 'text',
'name' => esc_html__( 'Estimated Cost Value', 'smartcrawl-htpv' ),
'id' => $prefix . 'estimated_cost_value',
'desc' => esc_html__( 'The estimated cost of the supplies consumed when performing instructions.', 'smartcrawl-htpv' ),
'placeholder' => 100,
],
[
'type' => 'text',
'name' => esc_html__( 'Estimated Cost Currency', 'smartcrawl-htpv' ),
'id' => $prefix . 'estimated_cost_currency',
'desc' => esc_html__( 'Use the currency acronym/abbreviation.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'USD', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Estimated Cost Max Value', 'smartcrawl-htpv' ),
'id' => $prefix . 'estimated_cost_max_value',
'desc' => esc_html__( 'The estimated maximum cost of the supplies consumed when performing instructions.', 'smartcrawl-htpv' ),
'placeholder' => 100,
],
[
'type' => 'text',
'name' => esc_html__( 'Estimated Cost Min Value', 'smartcrawl-htpv' ),
'id' => $prefix . 'estimated_cost_min_value',
'desc' => esc_html__( 'The estimated minimum cost of the supplies consumed when performing instructions.', 'smartcrawl-htpv' ),
'placeholder' => 100,
],
[
'type' => 'divider',
]
];
for( $m = 1; $m < 11; $m++ ) {
$affix = '_' . $m;
$htpv_items = array_merge(
$htpv_items,
[
[
'type' => 'text',
'name' => esc_html__( 'Supply ' . $m, 'smartcrawl-htpv' ),
'id' => $prefix . 'supply' . $affix,
'desc' => esc_html__( 'A supply consumed when performing instructions or a direction.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'A plain paper', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Supply ' . $m . ' Image', 'smartcrawl-htpv' ),
'id' => $prefix . 'supply' . $affix . '_image',
'desc' => esc_html__( 'An image of the supply. Images must be in .jpg, .png, or. gif format.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'https://example.com/wp-content/uploads/2022/01/photo.jpg', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Tool ' . $m, 'smartcrawl-htpv' ),
'id' => $prefix . 'tool' . $affix,
'desc' => esc_html__( 'An object used (but not consumed) when performing instructions or a direction. ', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'pencil', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Tool ' . $m . ' Image', 'smartcrawl-htpv' ),
'id' => $prefix . 'tool' . $affix . '_image',
'desc' => esc_html__( 'An image of the tool. Images must be in .jpg, .png, or. gif format.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'https://example.com/wp-content/uploads/2022/01/photo.jpg', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Step ' . $m, 'smartcrawl-htpv' ),
'id' => $prefix . 'step' . $affix,
'desc' => esc_html__( 'A step in the instructions for how to achieve a result.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'Draw a straight line.', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Step ' . $m . ' Text', 'smartcrawl-htpv' ),
'id' => $prefix . 'step' . $affix . '_text',
'desc' => esc_html__( 'The full instruction text of this step.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'Draw a straight line using a pencil and ruler ..', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Step ' . $m . ' Image', 'smartcrawl-htpv' ),
'id' => $prefix . 'step' . $affix . '_image',
'desc' => esc_html__( 'An image for the step. Images must be in .jpg, .png, or. gif format.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'https://example.com/wp-content/uploads/2022/01/photo.jpg', 'smartcrawl-htpv' ),
],
[
'type' => 'text',
'name' => esc_html__( 'Step ' . $m . ' URL', 'smartcrawl-htpv' ),
'id' => $prefix . 'step' . $affix . '_url',
'desc' => esc_html__( 'A URL that directly links to the step (if one is available). For example, an anchor link fragment.', 'smartcrawl-htpv' ),
'placeholder' => esc_html__( 'https://example.com/how-to-draw/#step-' . $m, 'smartcrawl-htpv' ),
],
[
'type' => 'divider',
],
]
);
}
$meta_boxes[] = [
'title' => esc_html__( 'How-to Property Values', 'smartcrawl-htpv' ),
'id' => 'smartcrawl_htpv',
'context' => 'normal',
'priority' => 'low',
'fields' => $htpv_items
];
return $meta_boxes;
}