StraMa87

Prova Plugin

May 10th, 2021 (edited)
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.17 KB | None | 0 0
  1. <?php
  2.  
  3. /* Classe AddScripts */
  4. namespace Info_Azienda;
  5.  
  6. class Add_Scripts
  7. {
  8.     public function __construct() {
  9.         add_action('wp_enqueue_scripts', array($this, "Add_Scripts_Plugin_Template"), 10 );
  10.  
  11.     }
  12.  
  13.     public function Add_Scripts_Plugin_Template() {
  14.         if(is_admin()){
  15.             wp_enqueue_script('info-azienda-js',  PLUGIN_DIR_URL . 'assets/js/index.js', array(), 1.0, true);
  16.             wp_enqueue_style('info-azienda-css', PLUGIN_DIR_URL . 'assets/css/main.css', array(), 1.0);
  17.         }
  18.     }
  19.  
  20. }
  21. /*--------------------------------------------------------------------------------------------------------------------------------*/
  22.  
  23. /*Classe Info_azienda*/
  24.  
  25. /**
  26. * classe principale starter plugin
  27. **/
  28.  
  29. namespace Info_Azienda;
  30. require_once(PLUGIN_DIR_API_PATH . '/includes/class-info.php');
  31. require_once(PLUGIN_DIR_API_PATH . '/includes/class-template-add.php');
  32. require_once(PLUGIN_DIR_API_PATH . '/includes/class-add-scripts.php');
  33.  
  34.  
  35. class Info_azienda{
  36.  
  37.   private $versione;
  38.  
  39.       public function __construct(){
  40.         $this->versione = Info::VERSIONE;
  41.         //inserire gli hooks che preferisci
  42.         $this->LoadDipendenze();
  43.       }
  44.  
  45.       public function LoadDipendenze(){
  46.         $TemplateAdd = new Tempate_Creator();
  47.         $script = new Add_Scripts();
  48.       }
  49. }
  50.  
  51. /*-------------------------------------------------------------------------------------------------------------------------*/
  52.  
  53. /*File Starter Plugin*/
  54.  
  55. namespace Info_Azienda;
  56.  
  57. if (!defined('WPINC')) {
  58.   die;
  59. }
  60.  
  61. Define('PLUGIN_DIR_URL' , plugin_dir_url(__FILE__));
  62. Define("PLUGIN_DIR_API_PATH", plugin_dir_path(__FILE__));
  63.  
  64.  
  65. register_activation_hook( __FILE__, __NAMESPACE__ . '\\activation' );
  66.   function activation(){
  67.     require_once(PLUGIN_DIR_API_PATH . '/includes/class-activator.php');
  68.     Activator::attivazione();
  69.  
  70.   }
  71.  
  72.  
  73. register_deactivation_hook( __FILE__,  __NAMESPACE__ .'\\deactivation' );
  74. function deactivation(){
  75.   require_once( PLUGIN_DIR_API_PATH . 'includes/class-deactivator.php');
  76.   Deactivator::disattivazione();
  77. }
  78.  
  79. require_once( PLUGIN_DIR_API_PATH . '/includes/class-plugin.php');
  80. $starter = new Info_azienda();
  81. ?>
  82.  
  83.  
Add Comment
Please, Sign In to add comment