convert to plugins+theme
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: ITStudio 核心内容
|
||||
* Plugin URI: https://git.itouc.cn/ITStudio_OUC/ITStudioMainSite
|
||||
* Description: ITStudio 主站的核心内容类型与内容行为:新闻/公告文章类型、内容权重字段、浏览量统计、归档扩展搜索与内容助手函数。是招新等其它插件的地基。
|
||||
* Version: 1.0.0
|
||||
* Author: ITStudio OUC
|
||||
* Text Domain: itstudio-content
|
||||
*
|
||||
* 说明:本插件从 ITStudioMainSite 主题的 functions.php 抽离而来。
|
||||
* 迁移铁律:文章类型 slug(news / announcement)、ACF 字段名(itstudio_weight)
|
||||
* 等标识符必须与主题历史保持一字不差,否则数据库中的老数据会失联。
|
||||
*/
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
define('ITSTUDIO_CONTENT_VERSION', '1.0.0');
|
||||
define('ITSTUDIO_CONTENT_PATH', plugin_dir_path(__FILE__));
|
||||
|
||||
require_once ITSTUDIO_CONTENT_PATH . 'includes/post-types.php';
|
||||
require_once ITSTUDIO_CONTENT_PATH . 'includes/post-views.php';
|
||||
require_once ITSTUDIO_CONTENT_PATH . 'includes/archive-search.php';
|
||||
require_once ITSTUDIO_CONTENT_PATH . 'includes/template-helpers.php';
|
||||
|
||||
/**
|
||||
* 激活时注册文章类型后刷新重写规则,保证 /news/ 等固定链接立即生效。
|
||||
*/
|
||||
function itstudio_content_activate() {
|
||||
itstudio_content_register_post_types();
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
register_activation_hook(__FILE__, 'itstudio_content_activate');
|
||||
|
||||
/**
|
||||
* 停用时同样刷新重写规则,清掉本插件注册的重写。
|
||||
*/
|
||||
function itstudio_content_deactivate() {
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
register_deactivation_hook(__FILE__, 'itstudio_content_deactivate');
|
||||
Reference in New Issue
Block a user