Guest User

Untitled

a guest
Jun 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. add_action( 'admin_init', function() {
  2. register_setting( 'my-awesome-plugin-settings', 'map_option_1' );
  3. register_setting( 'my-awesome-plugin-settings', 'map_option_2' );
  4. register_setting( 'my-awesome-plugin-settings', 'map_option_3' );
  5. register_setting( 'my-awesome-plugin-settings', 'map_option_4' );
  6. register_setting( 'my-awesome-plugin-settings', 'map_option_5' );
  7. register_setting( 'my-awesome-plugin-settings', 'map_option_6' );
  8.  
  9. });
  10.  
  11. function sort_post_plugin() {
  12. ?>
  13. <div class="wrap">
  14. <form action="options.php" method="post">
  15. <?php
  16. settings_fields( 'my-awesome-plugin-settings' );
  17. do_settings_sections( 'my-awesome-plugin-settings' );
  18. ?>
  19. <div class="title-set"><h1>SORT POST SETTINGS</h1></div>
  20. <table class="mytable">
  21. <tr>
  22. <th>Posty Type</th>
  23. <td><input type="text" placeholder="Post Type" name="map_option_1" value="<?php echo esc_attr( get_option('map_option_1') ); ?>" size="50" /></td>
  24.  
  25. </tr>
  26. <tr>
  27. <th>Meta Key</th>
  28. <td><input type="text" placeholder="Meta Key" name="map_option_2" value="<?php echo esc_attr( get_option('map_option_2') ); ?>" size="50" /></td>
  29. </tr>
  30. <tr>
  31. <th>Sorts</th>
  32. <td><input type="checkbox" placeholder="Meta Key" name="map_option_3" />Name<br>
  33. <input type="checkbox" id="cb_name" name="map_option_4">Price<br><input type="text" name="metakey" id="metakey" placeholder="Meta Key"></td>
  34.  
  35. </tr>
  36.  
  37. <tr>
  38. <td><?php submit_button(); ?></td>
  39. </tr>
  40.  
  41. </table>
  42. </form>
  43. </div>
  44. <?php
  45. }
  46. ?>
  47.  
  48. <td><input type="checkbox" placeholder="Meta Key" name="map_option_3"
  49. <?php // check whether map_option_3 was saved
  50. if(isset(get_option('map_option_3'))) { ?>checked="checked"<?php } ?>
  51. />Name<br>
  52. <input type="checkbox" id="cb_name" name="map_option_4"
  53. <?php // check whether map_option_4 was saved
  54. if(isset(get_option('map_option_4'))) { ?>checked="checked"<?php } ?>
  55. />Price<br><input type="text" name="metakey" id="metakey" placeholder="Meta Key"></td>
Add Comment
Please, Sign In to add comment