Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Plugin Name: My WooCommerce Plugin
- *
- */
- if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
- /**
- * My_WooCommerce_Plugin
- *
- * @since 1.0
- */
- if ( ! class_exists( 'My_WooCommerce_Plugin' ) ) {
- class My_WooCommerce_Plugin {
- function __construct(){
- add_action('plugins_loaded', array(&$this, 'hooks') );
- register_activation_hook( __FILE__ , array(&$this , 'install' ) );
- }
- public function hooks(){
- // Arrêter l'execution du plugin si WooCommerce n'exite plus.
- if( !class_exists( 'Woocommerce' ) )
- return;
- }
- public function install(){
- // Ne pas installer le plugin si WooCommerce n'est pas installer.
- if( !class_exists( 'Woocommerce' ) )
- wp_die('WooCommerce extension not found !');
- }
- }
- $load = new My_WooCommerce_Plugin();
- }
Advertisement
Add Comment
Please, Sign In to add comment