Skip to content

Instantly share code, notes, and snippets.

Created October 20, 2016 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c020098f0224bb9f983ec850909e0da6 to your computer and use it in GitHub Desktop.
Save anonymous/c020098f0224bb9f983ec850909e0da6 to your computer and use it in GitHub Desktop.
Ein Grundgerüst eines Plugins mit WPDK erstellt
<?php
/**
* Plugin Name: Test Plugin
* Plugin URI: http://your-domain.com
* Description: my WordPress plugin with full WPDK support
* Version: 1.0.0
* Author: You
* Author URI: http://your-domain.com
*/
// Include WPDK framework - the root directory name of WPDK may be different.
// Please change the line below according to your environment.
require_once( trailingslashit( dirname( __FILE__ ) ) . 'wpdk-production/wpdk.php' );
// Define of include your main plugin class
if( !class_exists( 'TestPlugin' ) ) {
class TestPlugin extends WPDKWordPressPlugin {
// Create an instance of TestPlugin class
public function __construct( $file )
{
parent::__construct( $file );
// You can include here
$this->defines();
}
// Include you own defines
private function defines()
{
include_once( 'defines.php' );
}
// Called when the plugin is activate - only first time
public function activation()
{
// To override
}
// Called when the plugin is deactivated
public function deactivation()
{
// To override
}
// Called when the plugin is loaded
public function loaded()
{
// To override
}
// Called when the plugin is fully loaded
public function preferences()
{
// To override
}
// Called only if the web request is related to the front-end side of WordPress
public function theme()
{
// To override
}
// Called only if the web request is related to the admin side of WordPress
public function admin()
{
// To override
}
}
}
$GLOBALS['TestPlugin'] = new TestPlugin( __FILE__ );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment