一、文件结构概述
二、核心函数解析
三、钩子机制详解
四、功能模块分析
五、开发者指南
文件路径 | 函数 / 钩子名称 | 类型 | 作用 |
---|---|---|---|
b2Jitheme/functions.php | custom_upload_filter |
函数 | 图片上传自动命名,通过添加日期和随机数避免文件名重复 |
b2Jitheme/functions.php | delete_post_and_attachments |
函数 | 在删除文章时,删除文章的特色图片和图片附件 |
b2Jitheme/functions.php | Jitheme_ask_cat_aaa |
函数 | 为问答分类添加自定义字段,如图标名称和图标编号 |
b2Jitheme/functions.php |
custom_columns_head |
函数 | 在 WP 后台文章列表中增加自定义列标题 “角标” |
b2Jitheme/functions.php | custom_columns_content |
函数 | 在 WP 后台文章列表的自定义列 “角标” 中显示自定义字段的值 |
b2Jitheme/functions.php |
isHomePage |
函数 | 判断当前页面是否为首页 |
b2Jitheme/functions.php |
get_latest_announcements |
函数 | 获取最新的公告文章,并以 JSON 格式返回文章的 ID、标题、日期和链接 |
b2Jitheme/functions.php | register_custom_api_routes |
函数 | 注册自定义 API 路由,用于获取最新的公告文章 |
b2Jitheme/functions.php | jitheme_home_xinxia |
函数 | 根据设置获取首页的公告信息,若有公告则显示公告内容,若无则显示提示信息 |
b2Jitheme/functions.php |
add_filter('wp_handle_upload_prefilter', 'custom_upload_filter') |
钩子 | 在文件上传前调用custom_upload_filter 函数对文件名进行处理 |
b2Jitheme/functions.php | add_action('before_delete_post', 'delete_post_and_attachments') |
钩子 | 在删除文章前调用delete_post_and_attachments 函数删除文章的相关附件 |
b2Jitheme/functions.php | add_action('cmb2_admin_init', 'Jitheme_ask_cat_aaa') |
钩子 | 在 CMB2 管理界面初始化时调用Jitheme_ask_cat_aaa 函数添加自定义字段 |
b2Jitheme/functions.php |
add_filter('manage_posts_columns', 'custom_columns_head') |
钩子 | 过滤 WP 后台文章列表的列标题,添加自定义列标题 |
b2Jitheme/functions.php | add_action('manage_posts_custom_column', 'custom_columns_content', 10, 2) |
钩子 | 在 WP 后台文章列表的自定义列中显示内容 |
b2Jitheme/functions.php | add_action('rest_api_init', 'register_custom_api_routes') |
钩子 | 在 REST API 初始化时注册自定义 API 路由 |
b2Jitheme/Center/Module/index_document_list.php | Post::get_categorys |
函数 | 获取文章的分类信息,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-form.php |
dragstart |
函数 | 处理文件、图片、视频、卡片拖动开始事件,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-form.php | dragenter |
函数 | 处理文件、图片、视频、卡片拖动进入事件,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-form.php |
dragend |
函数 | 处理文件、图片、视频、卡片拖动结束事件,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-form.php | removeFile |
函数 | 移除文件、图片、视频、卡片,具体实现未在提供代码中完整展示 |
b2Jitheme/Center/Module/index_imglist.php | get_term_by |
函数 | 根据条件获取分类术语对象,是 WordPress 核心函数 |
b2Jitheme/Center/Module/index_imglist.php |
query_posts |
函数 | 根据参数查询文章,是 WordPress 核心函数 |
b2Jitheme/Center/Module/index_imglist.php |
have_posts |
函数 | 判断是否有文章,是 WordPress 核心函数 |
b2Jitheme/Center/Module/index_imglist.php | the_post |
函数 | 设置当前文章为循环中的下一篇文章,是 WordPress 核心函数 |
b2Jitheme/Center/Module/index_imglist.php | wp_get_attachment_image_src |
函数 | 获取附件图片的源文件信息,是 WordPress 核心函数 |
b2Jitheme/Modules/Templates/Main.php | Main::init |
函数 | 初始化操作,包括加载 CSS 和 JS、加载模板、更改页面连接符等 |
b2Jitheme/Modules/Templates/Main.php | Main::setup_frontend_scripts |
函数 | 加载前端脚本,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php |
Main::regal_tag |
函数 | 过滤脚本标签,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php |
Main::load_templates |
函数 | 加载模板,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php | Main::document_title_separator |
函数 | 更改页面连接符,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php |
Main::custom_name |
函数 | 过滤自定义文章类型名称,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php | Main::hook_js |
函数 | 在 wp_head 中添加 JS 代码,具体实现未在提供代码中完整展示 |
b2Jitheme/Modules/Templates/Main.php | Main::my_ao_override_movelast |
函数 | 重写 Autoptimize 插件的 JS 移动到最后的设置 |
b2Jitheme/Modules/Templates/Main.php |
Main::hook_js_footer |
函数 | 在 wp_footer 中添加 LazyLoad 初始化代码 |
b2Jitheme/Modules/Templates/Main.php |
Main::footer_action |
函数 | 在 wp_footer 中添加 hook_js_footer 函数调用 |
b2Jitheme/Modules/Templates/Main.php | add_action( 'wp_enqueue_scripts', array( $this, 'setup_frontend_scripts' ),10 ) |
钩子 | 在加载前端脚本时调用Main::setup_frontend_scripts 函数 |
b2Jitheme/Modules/Templates/Main.php | add_filter( 'script_loader_tag', array($this,'regal_tag'), 10, 3 ) |
钩子 | 过滤脚本标签时调用Main::regal_tag 函数 |
b2Jitheme/Modules/Templates/Main.php | add_filter( 'document_title_separator', array($this,'document_title_separator'), 10, 1 ) |
钩子 | 更改页面连接符时调用Main::document_title_separator 函数 |
b2Jitheme/Modules/Templates/Main.php |
add_filter('b2_custom_post_type', array($this,'custom_name'), 1) |
钩子 | 过滤自定义文章类型名称时调用Main::custom_name 函数 |
b2Jitheme/Modules/Templates/Main.php | add_action('wp_head', array($this,'hook_js')) |
钩子 | 在 wp_head 中调用Main::hook_js 函数 |
b2Jitheme/Modules/Templates/Main.php |
add_action('wp',array($this,'footer_action'),999) |
钩子 | 在 wp 操作时调用Main::footer_action 函数 |
b2Jitheme/Modules/Templates/Main.php | add_filter('autoptimize_filter_js_movelast',array($this,'my_ao_override_movelast'),10,1) |
钩子 | 过滤 Autoptimize 插件的 JS 移动到最后的设置时调用Main::my_ao_override_movelast 函数 |
b2Jitheme/TempParts/single-document.php | Post::get_related_posts |
函数 | 获取相关文章,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-topic-list.php |
pickedFile |
函数 | 处理文件类型筛选事件,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/circle/circle-topic-list.php | pickedRole |
函数 | 处理角色类型筛选事件,具体实现未在提供代码中完整展示 |
b2Jitheme/TempParts/Ask/category.php | b2_pagenav |
函数 | 生成页码导航,具体实现未在提供代码中完整展示 |
b2Jitheme/Pages/vips.php | Onecad_vips_wenti |
函数 | 获取 VIP 常见问题内容,具体实现未在提供代码中完整展示 |
b2Jitheme/Center/Module/index_document.php | jithem_home_title |
函数 | 生成首页标题,具体实现未在提供代码中完整展示 |
文章标题:b2Jitheme 全解析:深入探究核心函数与钩子机制
文章链接:https://www.jitheme.com/7810.html
更新时间:2025年07月01日
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:service@jitheme.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读极(子)主题网络服务协议。