| 1 |
<?php |
| 2 |
function wp_insert_form_accordion_tabs_devices_styles( $control, $identifier, $location ) { |
| 3 |
echo '<h3>Devices & Styles</h3>'; |
| 4 |
echo '<div>'; |
| 5 |
$control->add_control( |
| 6 |
[ |
| 7 |
'type' => 'checkbox-button', |
| 8 |
'label' => 'Status : Show Ads', |
| 9 |
'checkedLabel' => 'Status : Hide Ads', |
| 10 |
'uncheckedLabel' => 'Status : Show Ads', |
| 11 |
'optionName' => 'device_exclude_large_desktop', |
| 12 |
] |
| 13 |
); |
| 14 |
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below</small></p>'; |
| 15 |
$control->add_control( |
| 16 |
[ |
| 17 |
'type' => 'number', |
| 18 |
'label' => 'Device Width (px)', |
| 19 |
'optionName' => 'device_large_desktop_width', |
| 20 |
'helpText' => 'The width of the browser screen.', |
| 21 |
'value' => ( ( ! isset( $control->values['device_large_desktop_width'] ) || ( $control->values['device_large_desktop_width'] == '' ) ) ? '1200' : $control->values['device_large_desktop_width'] ), |
| 22 |
] |
| 23 |
); |
| 24 |
$control->add_control( |
| 25 |
[ |
| 26 |
'type' => 'number', |
| 27 |
'label' => 'Ad Width (px)', |
| 28 |
'optionName' => 'device_large_desktop_adwidth', |
| 29 |
'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)', |
| 30 |
] |
| 31 |
); |
| 32 |
$control->add_control( |
| 33 |
[ |
| 34 |
'type' => 'textarea', |
| 35 |
'label' => 'Styles', |
| 36 |
'optionName' => 'device_large_desktop_styles', |
| 37 |
'helpText' => 'You can add CSS to customize your ad block for this device type', |
| 38 |
] |
| 39 |
); |
| 40 |
$control->create_section( 'Device - Large Desktop' ); |
| 41 |
$control->set_HTML( '<div class="wp_insert_rule_block">' . $control->HTML . '</div>' ); |
| 42 |
wp_insert_echo_html( $control->HTML ); |
| 43 |
$control->clear_controls(); |
| 44 |
|
| 45 |
$control->add_control( |
| 46 |
[ |
| 47 |
'type' => 'checkbox-button', |
| 48 |
'label' => 'Status : Show Ads', |
| 49 |
'checkedLabel' => 'Status : Hide Ads', |
| 50 |
'uncheckedLabel' => 'Status : Show Ads', |
| 51 |
'optionName' => 'device_exclude_medium_desktop', |
| 52 |
] |
| 53 |
); |
| 54 |
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below but smaller than Device Width set for Large Desktop</small></p>'; |
| 55 |
$control->add_control( |
| 56 |
[ |
| 57 |
'type' => 'number', |
| 58 |
'label' => 'Device Width (px)', |
| 59 |
'optionName' => 'device_medium_desktop_width', |
| 60 |
'helpText' => 'The width of the browser screen.', |
| 61 |
'value' => ( ( ! isset( $control->values['device_medium_desktop_width'] ) || ( $control->values['device_medium_desktop_width'] == '' ) ) ? '992' : $control->values['device_medium_desktop_width'] ), |
| 62 |
] |
| 63 |
); |
| 64 |
$control->add_control( |
| 65 |
[ |
| 66 |
'type' => 'number', |
| 67 |
'label' => 'Ad Width (px)', |
| 68 |
'optionName' => 'device_medium_desktop_adwidth', |
| 69 |
'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)', |
| 70 |
] |
| 71 |
); |
| 72 |
$control->add_control( |
| 73 |
[ |
| 74 |
'type' => 'textarea', |
| 75 |
'label' => 'Styles', |
| 76 |
'optionName' => 'device_medium_desktop_styles', |
| 77 |
'helpText' => 'You can add CSS to customize your ad block for this device type', |
| 78 |
] |
| 79 |
); |
| 80 |
$control->create_section( 'Devices - Medium Desktop' ); |
| 81 |
$control->set_HTML( '<div class="wp_insert_rule_block">' . $control->HTML . '</div><div style="clear: both;"></div>' ); |
| 82 |
wp_insert_echo_html( $control->HTML ); |
| 83 |
$control->clear_controls(); |
| 84 |
|
| 85 |
$control->add_control( |
| 86 |
[ |
| 87 |
'type' => 'checkbox-button', |
| 88 |
'label' => 'Status : Show Ads', |
| 89 |
'checkedLabel' => 'Status : Hide Ads', |
| 90 |
'uncheckedLabel' => 'Status : Show Ads', |
| 91 |
'optionName' => 'device_exclude_tablet', |
| 92 |
] |
| 93 |
); |
| 94 |
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below but smaller than Device Width set for Medium Desktop</small></p>'; |
| 95 |
$control->add_control( |
| 96 |
[ |
| 97 |
'type' => 'number', |
| 98 |
'label' => 'Device Width (px)', |
| 99 |
'optionName' => 'device_tablet_width', |
| 100 |
'helpText' => 'The width of the browser screen.', |
| 101 |
'value' => ( ( ! isset( $control->values['device_tablet_width'] ) || ( $control->values['device_tablet_width'] == '' ) ) ? '768' : $control->values['device_tablet_width'] ), |
| 102 |
] |
| 103 |
); |
| 104 |
$control->add_control( |
| 105 |
[ |
| 106 |
'type' => 'number', |
| 107 |
'label' => 'Ad Width (px)', |
| 108 |
'optionName' => 'device_tablet_adwidth', |
| 109 |
'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)', |
| 110 |
] |
| 111 |
); |
| 112 |
$control->add_control( |
| 113 |
[ |
| 114 |
'type' => 'textarea', |
| 115 |
'label' => 'Styles', |
| 116 |
'optionName' => 'device_tablet_styles', |
| 117 |
'helpText' => 'You can add CSS to customize your ad block for this device type', |
| 118 |
] |
| 119 |
); |
| 120 |
$control->create_section( 'Devices - Tablet' ); |
| 121 |
$control->set_HTML( '<div class="wp_insert_rule_block">' . $control->HTML . '</div>' ); |
| 122 |
wp_insert_echo_html( $control->HTML ); |
| 123 |
$control->clear_controls(); |
| 124 |
|
| 125 |
$control->add_control( |
| 126 |
[ |
| 127 |
'type' => 'checkbox-button', |
| 128 |
'label' => 'Status : Show Ads', |
| 129 |
'checkedLabel' => 'Status : Hide Ads', |
| 130 |
'uncheckedLabel' => 'Status : Show Ads', |
| 131 |
'optionName' => 'device_exclude_mobile', |
| 132 |
] |
| 133 |
); |
| 134 |
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are smaller than the Device Width set for Tablets</small></p>'; |
| 135 |
$control->add_control( |
| 136 |
[ |
| 137 |
'type' => 'number', |
| 138 |
'label' => 'Device Width (px)', |
| 139 |
'optionName' => 'device_mobile_width', |
| 140 |
'helpText' => 'The width of the browser screen.', |
| 141 |
'value' => ( ( ! isset( $control->values['device_mobile_width'] ) || ( $control->values['device_mobile_width'] == '' ) ) ? '480' : $control->values['device_mobile_width'] ), |
| 142 |
] |
| 143 |
); |
| 144 |
$control->add_control( |
| 145 |
[ |
| 146 |
'type' => 'number', |
| 147 |
'label' => 'Ad Width (px)', |
| 148 |
'optionName' => 'device_mobile_adwidth', |
| 149 |
'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)', |
| 150 |
] |
| 151 |
); |
| 152 |
$control->add_control( |
| 153 |
[ |
| 154 |
'type' => 'textarea', |
| 155 |
'label' => 'Styles', |
| 156 |
'optionName' => 'device_mobile_styles', |
| 157 |
'helpText' => 'You can add CSS to customize your ad block for this device type', |
| 158 |
] |
| 159 |
); |
| 160 |
$control->create_section( 'Devices - Mobile (Normal)' ); |
| 161 |
$control->set_HTML( '<div class="wp_insert_rule_block">' . $control->HTML . '</div><div style="clear: both;"></div>' ); |
| 162 |
wp_insert_echo_html( $control->HTML ); |
| 163 |
$control->clear_controls(); |
| 164 |
|
| 165 |
$control->add_control( |
| 166 |
[ |
| 167 |
'type' => 'checkbox-button', |
| 168 |
'label' => 'Status : Show Ads', |
| 169 |
'checkedLabel' => 'Status : Hide Ads', |
| 170 |
'uncheckedLabel' => 'Status : Show Ads', |
| 171 |
'optionName' => 'device_exclude_small_mobile', |
| 172 |
] |
| 173 |
); |
| 174 |
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are smaller than the Device Width set for Mobile (Normal)</small></p>'; |
| 175 |
$control->add_control( |
| 176 |
[ |
| 177 |
'type' => 'number', |
| 178 |
'label' => 'Ad Width (px)', |
| 179 |
'optionName' => 'device_small_mobile_adwidth', |
| 180 |
'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)', |
| 181 |
] |
| 182 |
); |
| 183 |
$control->add_control( |
| 184 |
[ |
| 185 |
'type' => 'textarea', |
| 186 |
'label' => 'Styles', |
| 187 |
'optionName' => 'device_small_mobile_styles', |
| 188 |
'helpText' => 'You can add CSS to customize your ad block for this device type', |
| 189 |
] |
| 190 |
); |
| 191 |
$control->create_section( 'Devices - Mobile (Small)' ); |
| 192 |
$control->set_HTML( '<div class="wp_insert_rule_block">' . $control->HTML . '</div><div style="clear: both;"></div>' ); |
| 193 |
wp_insert_echo_html( $control->HTML ); |
| 194 |
$control->clear_controls(); |
| 195 |
|
| 196 |
$control->add_control( |
| 197 |
[ |
| 198 |
'type' => 'textarea', |
| 199 |
'style' => 'height: 220px;', |
| 200 |
'optionName' => 'styles', |
| 201 |
'helpText' => 'You can add CSS to customize your ad block', |
| 202 |
] |
| 203 |
); |
| 204 |
$control->create_section( 'Styles (Common)' ); |
| 205 |
wp_insert_echo_html( $control->HTML ); |
| 206 |
$control->clear_controls(); |
| 207 |
echo '</div>'; |
| 208 |
return $control; |
| 209 |
} |
| 210 |
|