touhid_xml

NS Contact

Oct 31st, 2020
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. Plugin Name: NS Contact
  4. Plugin URI: https://fb.com/touhid.dnj
  5. Description: Just another contact form plugin. Simple but flexible.
  6. Author: Tohidul Islam
  7. Author URI: https://fb.com/touhid.dnj
  8. Text Domain: ns-contact
  9. Domain Path: /languages/
  10. Version: 1.0
  11. */
  12.  
  13. define('PLUGIN_DIR',plugin_dir_path(__FILE__));
  14. define('PLUGIN_URL',plugin_dir_url(__FILE__));
  15.  
  16. /*echo PLUGIN_URL;
  17. echo "<hr />\n";
  18. echo PLUGIN_DIR; die();*/
  19.  
  20. add_action('admin_menu', 'custom_menu');
  21.  
  22. function custom_menu() {
  23.  
  24.     add_menu_page(
  25.         'NS Contact',
  26.         'NS Contact',
  27.         'manage_options',
  28.         'ns-contact',
  29.         'view_contact_callback',
  30.         'dashicons-media-spreadsheet'
  31.  
  32.     );
  33.     add_submenu_page('ns-contact','View Contacts','View Contacts','manage_options','ns-contact','view_contact_callback',1);
  34.     add_submenu_page('ns-contact','Add Contacts','Add Contacts','manage_options','ns-add-contact','add_contact_callback',2);
  35. }
  36.  
  37. function ns_contact_enqueue_styles( $hook ) {
  38. /*    if ( 'edit.php' != $hook ) {
  39.         return;
  40.     }*/
  41. //    admin_enqueue_style( 'ns_styles', PLUGIN_URL . 'assets/css/main.css', array(), '1.0' );
  42.     wp_register_style( 'ns_styles', PLUGIN_URL . 'assets/css/main.css', false, '1.0.0' );
  43.     wp_enqueue_style( 'ns_styles' );
  44.     wp_register_script( 'ns_scripts', PLUGIN_URL . 'assets/js/main.js', true, '1.0.0' );
  45.     wp_enqueue_script( 'ns_scripts' );
  46.  
  47.  
  48.  
  49. }
  50. add_action( 'admin_enqueue_scripts', 'ns_contact_enqueue_styles' );
  51.  
  52.  
  53. function page_callback(){
  54. echo "<h1 style='color: red;'>Setting - NS Contact</h1>";
  55. }
  56.  
  57. function view_contact_callback(){
  58.    include_once PLUGIN_DIR.'views/view_contacts.php';
  59. }
  60.  
  61. function add_contact_callback(){
  62.     include_once PLUGIN_DIR.'views/add_contact.php';
  63. }
Add Comment
Please, Sign In to add comment