现在这是实际版本
<?php
/**
* @package stoerer
* Plugin Name: Störer
* Plugin URI: http://www.mywebsite.com/stoerer
* Description: Ein Störer für ddcom AG
* Author: TM
* Author URI: http://www.mywebsite.com
* Version 1.0.0
*/
if ( ! defined( \'ABSPATH\' ) ){
die;
}
class stoererPlugin
{
function __construct() {
add_action( \'init\', array( $this, \'custom_post_type\'));
}
function register(){
add_action( \'wp_enqueue_scripts\', array( $this, \'enqueue\' ) );
}
function activate(){
//generated a cPT
// $this->custom_post_type();
// flush rewrite rules
flush_rewrite_rules();
}
function deactivate() {
// flush rewrite rules
flush_rewrite_rules();
}
function enqueue() {
//enqueue all our scripts
wp_enqueue_style( \'mypluginstyle\', plugins_url( \'/assets/mystyle.css\', __FILE__ ));
wp_enqueue_script( \'mypluginscript\', plugins_url( \'/assets/myscripts.js\', __FILE__));
}
function custom_post_type() {
register_post_type( \'book\', [\'public\' => true, \'label\' => \'Books\']);
}
// methods
}
if ( class_exists( \'stoererPlugin\')) {
$stoererPlugin = new stoererPlugin();
$stoererPlugin->register();
}
// activation
register_activation_hook( __FILE__, array( $stoererPlugin, \'activate\'));
// deactivation
register_deactivation_hook( __FILE__, array( $stoererPlugin, \'deactivate\'));
//uninstall
?>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title> Störer</title>
</head>
<body>
<button class="stoerer" id="stoerer"onclick="buttonShow()">Ich bin ein Störer</button>
<!-- Und dann die Info-Box -->
<div id="infoBox">
<button class="cross" type="button" onclick="buttonHide()">X</button>
<p> Hello </p> <?php add_shortcode( \'get_current_user\' , \'wp_get_current_user_func\' );
function wp_get_current_user_func( $atts ) {
$current_user = wp_get_current_user();
if ($current_user != 0)
{
return $current_user->user_firstname;
} else
{
return "";
}
}?>
<p> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gub
</p>
</div>
</body>
</html>
也许你也知道为什么我的后端也会改变。它似乎不仅在前端使用,在后端也有我的lorem ipsum文本。