1, first of all, I now write a pugins folder under the plugin
Copy PHP content to clipboard
PHP Code:
<?php
/*
Plugin Name: test
Plugin URI: [url=http://wordpress.org/]http://wordpress.org/[/url]#
Description: 我测试用的
Author: lw(fantasy)
Version: 0.1
Author URI: [url=http://www.xxx.com/]http://www.xxx.com/[/url]
*/
$test = "<div id='my_test'>这是我的第一个插件!</div>";
function output(){
global $test;
echo $test;
}
add_action('wp_footer','output');
?>
And then enable it in the background.
2, WP implementation is loaded in the "wp-settings.php", and in this file, you can find the following plug-in-related code snippets:
Copy PHP content to clipboard
PHP Code:
if ( get_option('active_plugins') ) {
$current_plugins = get_option('active_plugins');
dump($current_plugins);
if ( is_array($current_plugins) ) {
foreach ($current_plugins as $plugin) {
if ( '' != $plugin && 0 == validate_file($plugin) && file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
include_once(WP_PLUGIN_DIR . '/' . $plugin);
}
}}
I dump a bit of $current_plugins and get
Array
(
[0] => Fanfou-Daily/Fanfou-Daily.php
[1] => mulberrykit.php
[2] => test.php
)
I can see that the test.php plugin I wrote has been included.
3, in the theme template in the footer.php inside will perform a function
<?php Wp_footer ();?>
And this wp_footer inside and out.
Do_action (' Wp_footer ');