Changeset 2444723
- Timestamp:
- 12/23/2020 02:57:56 AM (5 years ago)
- File:
-
- 1 edited
-
simple-image-popup/trunk/simple-image-popup.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-image-popup/trunk/simple-image-popup.php
r2444721 r2444723 123 123 ); 124 124 125 add_settings_field( 126 'sip_popup_expiry', // ID used to identify the field throughout the theme 127 'Cookie expiry (minutes)', // The label to the left of the option interface element 128 array($this, 'sip_popup_expiry_callback'), // The name of the function responsible for rendering the option interface 129 'sip_plugin_options', // The page on which this option will be displayed 130 'sip_image_options', // The name of the section to which this field belongs 131 null 132 ); 125 133 126 134 127 // Finally, we register the fields with WordPress … … 262 255 } 263 256 264 public function sip_popup_expiry_callback($args) 265 { 266 267 // Field for expiry of popup cookie 268 269 $options = get_option('sip_plugin_options'); 270 271 $default_minutes = 0; 272 273 $expiry = isset($options['sip_popup_expiry']) ? $options['sip_popup_expiry'] : $default_minutes; 274 275 // Note the ID and the name attribute of the element should match that of the ID in the call to add_settings_field 276 $html = ' 277 <input type="number" min="0" id="sip_popup_expiry" name="sip_plugin_options[sip_popup_expiry]" value="' . $expiry . '" placeholder="0 to disable"/> 278 '; 279 280 echo $html; 281 282 } 283 257 284 258 public function sip_image_status_callback($args) 285 259 { … … 304 278 $image_url = isset($options['sip_image_url']) ? $options['sip_image_url'] : null; 305 279 $link = isset($options['sip_link']) ? $options['sip_link'] : null; 306 $expiry = isset($options['sip_popup_expiry']) ? $options['sip_popup_expiry'] : 0;307 280 $active = isset($options['sip_plugin_status']) ? true : false; 308 281 $clicktoclose = isset($options['sip_click_to_close']) ? true : false;
Note: See TracChangeset
for help on using the changeset viewer.