Last active
November 30, 2015 15:51
-
-
Save marketpress-support-team/e68f15f61f3625fbb712 to your computer and use it in GitHub Desktop.
Mini-Plugin-Boilerplate für eigene Anpassungen. Informationen zu den verwendeten WordPress-Hooks: http://www.rarst.net/wordpress/wordpress-core-load/ Schnell-Tutorial zu Hooks und Filtern: https://gist.github.com/marketpress-support-team/12fc81fcfb2ba797735b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: _Anpassungen | |
* Description: Deine eigenen Anpassungen | |
* Version: 2015.11 | |
* Author: Du :) | |
* License: GNU General Public License v3 or later | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
/** | |
* Anpassungen via Hook plugins_loaded. | |
* | |
* @return void | |
*/ | |
function _anpassungen__plugins_loaded() { | |
/** | |
* Test. Zeigt einen Admin-Hinweis, wenn das Plugin aktiv ist. | |
* Sollte im produktiven Einsatz entfernt werden. | |
*/ | |
add_action( 'admin_notices', function() { | |
$msg = sprintf( | |
'<p>%s</p>', | |
'<strong>Anpassungen</strong> sind aktiv!' | |
); | |
$classes = 'notice-info is-dismissible'; | |
printf( | |
'<div class="notice %1$s">%2$s</div>', | |
$classes, | |
$msg | |
); | |
} ); | |
/* Dein Code hier. */ | |
/* Nur für WooCommerce German Market. */ | |
if ( class_exists( 'WGM_Template' ) ) { | |
/* Dein WGM-Code hier. */ | |
} | |
/* Nur für WooCommerce. */ | |
if ( class_exists( 'WooCommerce' ) ) { | |
/* Dein WooCommerce-Code hier. */ | |
} | |
} | |
add_action( 'plugins_loaded', '_anpassungen__plugins_loaded' ); | |
/** | |
* Anpassungen via Hook after_setup_theme. | |
* | |
* @return void | |
*/ | |
function _anpassungen__after_setup_theme() { | |
/* Dein Code hier. */ | |
} | |
add_action( 'after_setup_theme', '_anpassungen__after_setup_theme' ); | |
/** | |
* Anpassungen via Hook init. | |
* | |
* @return void | |
*/ | |
function _anpassungen__init() { | |
/* Dein Code hier. */ | |
} | |
add_action( 'init', '_anpassungen__init' ); | |
/** | |
* Anpassungen via Hook template_redirect. | |
* | |
* @return void | |
*/ | |
function _anpassungen__template_redirect() { | |
/* Dein Code hier. */ | |
} | |
add_action( 'template_redirect', '_anpassungen__template_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment