Changeset 3166970
- Timestamp:
- 10/11/2024 07:08:41 AM (18 months ago)
- File:
-
- 1 edited
-
exly-wp/trunk/admin/class-exly-wp-admin.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
exly-wp/trunk/admin/class-exly-wp-admin.php
r3115276 r3166970 428 428 } 429 429 430 // Register the setting and add the settings section and field 431 add_action('admin_init', 'my_plugin_register_settings'); 432 433 function my_plugin_register_settings() { 434 // Register the custom field setting 435 register_setting('my_plugin_settings_group', 'custom_field'); 436 437 // Add the section where your field will appear 438 add_settings_section( 439 'my_plugin_section', // Section ID 440 'Settings', // Section Title 441 'my_plugin_section_callback', // Callback function for section description 442 'my_plugin_settings_page' // Page slug where the section will appear 443 ); 444 445 // Add the field to the section 446 add_settings_field( 447 'custom_field', // Field ID 448 'Custom Domain', // Field Title 449 'display_custom_field', // Callback to display the field 450 'my_plugin_settings_page', // Page slug where the field will appear 451 'my_plugin_section' // Section ID where the field will appear 452 ); 453 } 454 455 // Section callback (can be empty or with a description) 456 function my_plugin_section_callback() { 457 echo '<p>The Custom Domain must be linked with your Exly account via the integrations page</p>'; 458 } 459 460 // Display the custom field 461 function display_custom_field() { 462 $customField = get_option('custom_field'); 463 echo "<span class='prefix'>https:// </span><input type='text' name='custom_field' id='customFieldUrl' placeholder='Enter your domain' value='" . esc_attr($customField) . "' />"; 464 echo "<p class='error-message' id='urlError'>Please do not include <b>https://</b> or <b>http://</b>.</p>"; 465 466 }
Note: See TracChangeset
for help on using the changeset viewer.