Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: NS Contact
- Plugin URI: https://fb.com/touhid.dnj
- Description: Just another contact form plugin. Simple but flexible.
- Author: Tohidul Islam
- Author URI: https://fb.com/touhid.dnj
- Text Domain: ns-contact
- Domain Path: /languages/
- Version: 1.0
- */
- define('PLUGIN_DIR',plugin_dir_path(__FILE__));
- define('PLUGIN_URL',plugin_dir_url(__FILE__));
- /*echo PLUGIN_URL;
- echo "<hr />\n";
- echo PLUGIN_DIR; die();*/
- add_action('admin_menu', 'custom_menu');
- function custom_menu() {
- add_menu_page(
- 'NS Contact',
- 'NS Contact',
- 'manage_options',
- 'ns-contact',
- 'view_contact_callback',
- 'dashicons-media-spreadsheet'
- );
- add_submenu_page('ns-contact','View Contacts','View Contacts','manage_options','ns-contact','view_contact_callback',1);
- add_submenu_page('ns-contact','Add Contacts','Add Contacts','manage_options','ns-add-contact','add_contact_callback',2);
- }
- function ns_contact_enqueue_styles( $hook ) {
- /* if ( 'edit.php' != $hook ) {
- return;
- }*/
- // admin_enqueue_style( 'ns_styles', PLUGIN_URL . 'assets/css/main.css', array(), '1.0' );
- wp_register_style( 'ns_styles', PLUGIN_URL . 'assets/css/main.css', false, '1.0.0' );
- wp_enqueue_style( 'ns_styles' );
- wp_register_script( 'ns_scripts', PLUGIN_URL . 'assets/js/main.js', true, '1.0.0' );
- wp_enqueue_script( 'ns_scripts' );
- }
- add_action( 'admin_enqueue_scripts', 'ns_contact_enqueue_styles' );
- function page_callback(){
- echo "<h1 style='color: red;'>Setting - NS Contact</h1>";
- }
- function view_contact_callback(){
- include_once PLUGIN_DIR.'views/view_contacts.php';
- }
- function add_contact_callback(){
- include_once PLUGIN_DIR.'views/add_contact.php';
- }
Add Comment
Please, Sign In to add comment