Skip to content

Instantly share code, notes, and snippets.

/testplugin.php

Created Oct 20, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.