Guest User

Untitled

a guest
Jan 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. public function section_callback() {
  2. echo '<p>Select which areas of content you wish to display.</p>';
  3. }
  4.  
  5. public function field_callback() {
  6. $html = '<input type="text" id="input_offer" name="questionaire[input_field]" />';
  7. echo $html;
  8. }
  9.  
  10. public function register_settings() {
  11. // First, we register a section. This is necessary since all future options must belong to a
  12. add_settings_section(
  13. 'my_settings_section', // ID used to identify this section and with which to register options
  14. 'iPhones', // Title to be displayed on the administration page
  15. 'section_callback', // Callback used to render the description of the section
  16. $this->plugin_name // Page on which to add this section of options
  17. );
  18.  
  19. // Next, we'll introduce the fields for toggling the visibility of content elements.
  20. add_settings_field(
  21. 'input_field', // ID used to identify the field throughout the theme
  22. 'Offer', // The label to the left of the option interface element
  23. 'field_callback', // The name of the function responsible for rendering the option interface
  24. $this->plugin_name, // The page on which this option will be displayed
  25. 'my_settings_section' // The name of the section to which this field belongs
  26. );
  27.  
  28. register_setting( $this->plugin_name, 'input_field' );
  29. }
  30.  
  31. private function define_admin_hooks() {
  32.  
  33. $plugin_admin = new Questionaire_Admin( $this->get_plugin_name(), $this->get_version() );
  34.  
  35. ...
  36.  
  37. $this->loader->add_action( 'admin_init', $plugin_admin, 'register_settings' );
  38.  
  39. ...
  40.  
  41. }
Add Comment
Please, Sign In to add comment