Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. function myplugin_register_settings() {
  2. add_option( 'myplugin_option_name', 'This is my option value.');
  3. register_setting( 'myplugin_options_group', 'myplugin_option_name', 'myplugin_callback' );
  4. }
  5. add_action( 'admin_init', 'myplugin_register_settings' );
  6.  
  7. function myplugin_register_options_page() {
  8. add_options_page('Page Title', 'Plugin Menu', 'manage_options', 'myplugin', 'myplugin_options_page');
  9. }
  10. add_action('admin_menu', 'myplugin_register_options_page');
  11.  
  12. function myplugin_options_page()
  13. {
  14. ?>
  15. <div>
  16. <?php screen_icon(); ?>
  17. <h2>ID Settings</h2>
  18. <form method="post" action="options.php">
  19. <?php settings_fields( 'myplugin_options_group' ); ?>
  20. <h3>Set Store ID</h3>
  21. <p>Please enter the store id given to you by the publisher</p>
  22. <table>
  23. <tr valign="top">
  24. <th scope="row"><label for="myplugin_option_name">StoreID</label></th>
  25. <td><input type="text" id="myplugin_option_name" name="myplugin_option_name" value="<?php echo get_option('myplugin_option_name'); ?>" /></td>
  26. </tr>
  27. </table>
  28. <?php submit_button(); ?>
  29. </form>
  30. </div>
  31. <?php
  32. }
  33.  
  34. global $product;
  35. $category = 'excludecat';
  36. if ( has_term( $category, 'product_cat', $product->id ) )
  37. }
  38.  
  39. add_action( 'woocommerce_product_meta_start', 'myplugin_value' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement