first commit
This commit is contained in:
35
index.php
Normal file
35
index.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: 子比主题·演示插件
|
||||
Plugin URI: https://www.vxras.com/
|
||||
Description: 子比主题定制插件
|
||||
Version: 1.0.0
|
||||
Author: 李初一
|
||||
Author URI: https://www.vxras.com/
|
||||
*/
|
||||
|
||||
// 定义插件常量
|
||||
define('zib_plugin_demo_url', plugins_url('', __FILE__));
|
||||
define('zib_plugin_demo_path', plugin_dir_path(__FILE__));
|
||||
|
||||
// 获取插件菜单设置
|
||||
if (!function_exists('zib_plugin_demo')) {
|
||||
function zib_plugin_demo($option = '', $default = null) {
|
||||
$options = get_option('zib_plugin_demo');
|
||||
return (isset($options[$option])) ? $options[$option] : $default;
|
||||
}
|
||||
}
|
||||
|
||||
// 在主题启用后引入文件
|
||||
function zib_plugin_demo_init() {
|
||||
|
||||
$require_once = array(
|
||||
'includes/functions.php',
|
||||
'includes/admin-options.php',
|
||||
);
|
||||
|
||||
foreach ( $require_once as $require ) {
|
||||
require_once plugin_dir_path( __FILE__ ) . $require;
|
||||
}
|
||||
}
|
||||
add_action( 'after_setup_theme', 'zib_plugin_demo_init' );
|
||||
Reference in New Issue
Block a user