File: /www/wwwroot/www.sceybwg.com/wp-content/themes/Modular/extends/theme-module/public/hooks.php
<?php
declare(strict_types=1);
add_action('wpjam_module_loaded', function(){
//模块页面可添加数量
wpjam_set_max_module_pages(1000);
WPJAM_Module_Type::get_options();
//移除 WPJAM Module 插件的默认模块
wpjam_unregister_module_type('slider');//幻灯片
wpjam_unregister_module_type('nav');//快捷导航
wpjam_unregister_module_type('cube');//图片魔方
wpjam_unregister_module_type('text-list');//文本列表
wpjam_unregister_module_type('text');//简单文本
wpjam_unregister_module_type('form');//表单
if(is_admin()){
add_action('admin_menu', fn()=> remove_submenu_page('wpjam-pages', 'wpjam-page-icons'));
wpjam_add_admin_load([
'plugin_page' => 'wpjam-pages',
'callback' => fn()=> wpjam_unregister_list_table_column('page-icons')
]);
}
add_filter('wpjam_module_type_fields', function($fields, $action_key){
if($action_key == 'setting'){
return ['animation' => ['title'=>'过渡动画', 'type'=>'select', 'options'=>[
'' => '无效果',
'rollIn' => ['label'=>'rollIn', 'description'=>'从左到右、顺时针滚动'],
'bounceInUp' => ['label'=>'bounceInUp', 'description'=>'从原位置出现,由小变大超出设定值,再变小小于设定值,再回归设定值'],
'bounceInDown' => ['label'=>'bounceInDown', 'description'=>'从下往上、窜上来以后会向上超出一部分然后弹回去'],
'bounceInLeft' => ['label'=>'bounceInLeft', 'description'=>'从上往下、掉下来以后会向下超出一部分然后弹跳一下'],
'bounceInRight' => ['label'=>'bounceInRight', 'description'=>'从左往右、移过来以后会向右超出一部分然后往左弹一下'],
'slideInUp' => ['label'=>'slideInUp', 'description'=>'从下往上、上来后固定到设定位置'],
'slideInDown' => ['label'=>'slideInDown', 'description'=>'从上往下、上来后固定到设定位置'],
'slideInLeft' => ['label'=>'slideInLeft', 'description'=>'从左往右、上来后固定到设定位置'],
'slideInRight' => ['label'=>'slideInRight', 'description'=>'从右往左、上来后固定到设定位置'],
'lightSpeedIn' => ['label'=>'lightSpeedIn', 'description'=>'从右往左、头部先向右倾斜,又向左倾斜,最后变为原来的形状'],
'pulse' => ['label'=>'pulse', 'description'=>'原位置放大一点点在缩小至原本大小'],
'flipInX' => ['label'=>'flipInX', 'description'=>'原位置后仰前栽'],
'flipInY' => ['label'=>'flipInY', 'description'=>'原位置左右旋动'],
'bounce' => ['label'=>'bounce', 'description'=>'上下抖动'],
'shake' => ['label'=>'shake', 'description'=>'左右抖动'],
'swing' => ['label'=>'swing', 'description'=>'从右往左、头部先向右倾斜,又向左倾斜,最后变为原来的形状'],
'wobble' => ['label'=>'wobble', 'description'=>'原位置不变、类似于一个人站在那左右晃头'],
]]]+$fields;
}
return $fields;
}, 10, 2);
//加载主题模块
include_once __DIR__ . '/classes.php';
//注册主题模块
wpjam_register_module_type('theme-slider', [
'title' => '幻灯片/滑块',
'model' => 'WPJAM_Module_Theme_Slider',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-slider.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-search', [
'title' => '搜索词+搜索框',
'model' => 'WPJAM_Module_Theme_Search',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-search.jpg',
'content_path' => false,
'title_display' => true,
'title_custom' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-product-tab', [
'title' => '产品展示/TAB切换',
'model' => 'WPJAM_Module_Theme_Product_Tab',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-product-tab.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-imgtext-banner', [
'title' => '图文横幅',
'model' => 'WPJAM_Module_Theme_ImgText_Banner',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-imgtext-banner.jpg',
'excerpt' => true,
'content_path' => false,
'title_display' => true,
'title_custom' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-cross-layout', [
'title' => '图文交叉布局',
'model' => 'WPJAM_Module_Theme_Cross_Layout',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-cross-layout.jpg',
//'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-about', [
'title' => '关于我们',
'model' => 'WPJAM_Module_Theme_About',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-about.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-news', [
'title' => '新闻资讯',
'model' => 'WPJAM_Module_Theme_News',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-news.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-news-2', [
'title' => '新闻资讯-2',
'model' => 'WPJAM_Module_Theme_News_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-news-2.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-news-3', [
'title' => '新闻资讯-3',
'model' => 'WPJAM_Module_Theme_News_3',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-news-3.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-case', [
'title' => '案例展示',
'model' => 'WPJAM_Module_Theme_Case',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-case.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-partners', [
'title' => '合作伙伴(静态)',
'model' => 'WPJAM_Module_Theme_Partners',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-partners.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-partners-2', [
'title' => '合作伙伴(滚动)',
'model' => 'WPJAM_Module_Theme_Partners_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-partners-2.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-aptitude', [
'title' => '荣誉资质',
'model' => 'WPJAM_Module_Theme_Aptitude',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-aptitude.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-contact', [
'title' => '联系我们',
'model' => 'WPJAM_Module_Theme_Contact',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-contact.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-features', [
'title' => '特点介绍',
'model' => 'WPJAM_Module_Theme_Features',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-features.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-features-2', [
'title' => '特点介绍-2',
'model' => 'WPJAM_Module_Theme_Features_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-features-2.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-text', [
'title' => '文本内容',
'model' => 'WPJAM_Module_Theme_Text',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-text.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-count', [
'title' => '滚动数字',
'model' => 'WPJAM_Module_Theme_Count',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-count.jpg',
'excerpt' => true,
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-links', [
'title' => '友情链接',
'model' => 'WPJAM_Module_Theme_Links',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-links.jpg',
'title_display' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-service', [
'title' => '服务项目',
'model' => 'WPJAM_Module_Theme_Service',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-service.jpg',
'title_display' => true,
'excerpt' => true,
'max_items' => 5,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-tab', [
'title' => '自定义TAB',
'model' => 'WPJAM_Module_Theme_Tab',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-tab.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-tab-2', [
'title' => '自定义TAB',
'model' => 'WPJAM_Module_Theme_Tab_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-tab-2.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-form', [
'title' => '表单',
'model' => 'WPJAM_Module_Theme_Form',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-form.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-breadcrumb', [
'title' => '面包屑导航+搜索',
'model' => 'WPJAM_Module_Theme_Breadcrumb',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-breadcrumb.jpg',
'title_display' => false,
'excerpt' => false,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-gallery', [
'title' => '相册/图集',
'model' => 'WPJAM_Module_Theme_Gallery',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-gallery.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-history', [
'title' => '时间轴',
'model' => 'WPJAM_Module_Theme_History',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-history.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-history-2', [
'title' => '发展历程',
'model' => 'WPJAM_Module_Theme_History_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-history-2.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-faq', [
'title' => '常见问题',
'model' => 'WPJAM_Module_Theme_Faq',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-faq.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-faq-2', [
'title' => '常见问题-2',
'model' => 'WPJAM_Module_Theme_Faq_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-faq-2.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-download', [
'title' => '资料下载',
'model' => 'WPJAM_Module_Theme_Download',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-download.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-pricing', [
'title' => '价格表',
'model' => 'WPJAM_Module_Theme_Pricing',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-pricing.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-reviews', [
'title' => '客户评价',
'model' => 'WPJAM_Module_Theme_Reviews',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-reviews.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-team', [
'title' => '团队成员',
'model' => 'WPJAM_Module_Theme_Team',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-team.jpg',
'title_display' => true,
'excerpt' => true,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-video', [
'title' => '视频',
'model' => 'WPJAM_Module_Theme_Video',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-video.jpg',
'excerpt' => true,
'content_path' => false,
'title_display' => true,
'title_custom' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-post', [
'title' => '文章/资讯',
'model' => 'WPJAM_Module_Theme_Post',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-post.jpg',
'excerpt' => true,
'content_path' => false,
'title_display' => true,
'title_custom' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-post-2', [
'title' => '文章/资讯(滚动)',
'model' => 'WPJAM_Module_Theme_Post_2',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-post-2.jpg',
'excerpt' => true,
'content_path' => false,
'title_display' => true,
'title_custom' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-shortcode', [
'title' => '短代码',
'model' => 'WPJAM_Module_Theme_Shortcode',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-shortcode.jpg',
'title_display' => false,
'excerpt' => false,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
wpjam_register_module_type('theme-html', [
'title' => '自定义Html',
'model' => 'WPJAM_Module_Theme_Html',
'image' => get_template_directory_uri().'/static/images/modules-thumbnail/modules-html.jpg',
'title_display' => false,
'excerpt' => false,
'title_custom' => false,
'content_path' => false,
'item_path' => false
]);
}, 99);