upstatement/jigsaw
Composer 安装命令:
composer require upstatement/jigsaw
包简介
Provides an easy API for developers to tweak the admin options of a WordPress install
关键字:
README 文档
README
Simple ways to make admin customizations for WordPress. You know all that brain space you saved for memorizing hooks? Use it for something better. For example, you can...
Add a column to an admin page!
Jigsaw::add_column($post_type, $column_label, $callback_function, $order = 10);
Jigsaw::add_column('slides', 'Preview', function($pid){ $data = array(); $data['post'] = new TimberPost($pid); Timber::render('admin/slide-table-preview.twig', $data); }, 5);
Jigsaw::add_column(array('slides', 'post'), 'Preview', function($pid){ $data = array(); $data['post'] = new TimberPost($pid); Timber::render('admin/slide-table-preview.twig', $data); });
Add a column to the users table!
Jigsaw::add_user_column($column_label, $callback_function, $order = 10);
Jigsaw::add_user_column('Favorite Band', function($uid){ echo get_user_meta($uid, 'favorite-band', true); }, 5);
Remove a column from the admin
Jigsaw::remove_column($post_types, $column_slug);
Jigsaw::remove_column('slides', 'author');
Jigsaw::remove_column(array('slides', 'post'), 'author');
Add something to the admin bar
Jigsaw::add_toolbar_item($label, $url_or_callback_function);
Jigsaw::add_toolbar_item('Clear Cache', function(){ $total_cache->flush_all(); });
Add a dropdown
Jigsaw::add_toolbar_group($label, $items);
$optionOne = new stdClass(); $optionOne->label = 'All Caches'; $optionOne->action = function(){ $total_cache->flush_all(); }; $optionTwo = new stdClass(); $optionTwo->label = 'Page Cache'; $optionTwo->action = function(){ $total_cache->flush_page_cache(); }; $optionThree = array('Home', 'http://localhost'); Jigsaw::add_toolbar_group('Clear Cache', array($optionOne, $optionTwo, $optionThree));
Show an admin notice
Jigsaw::show_notice($message, $level = 'updated');
Jigsaw::show_notice('Cache has been flushed', 'updated');
...or
Jigsaw::show_notice('Error flushing cache, is the plugin activated?', 'error');
Add a CSS file to the admin
Jigsaw::add_css($css_file);
Jigsaw::add_css('css/my-admin-style.css');
Add a JS file to the admin
Jigsaw::add_js($css_file);
Jigsaw::add_js('js/my-admin-script.js');
JigsawPermalinks
Set the base of the author permalink
JigsawPermalinks::set_author_base($base_string);
JigsawPermalinks::set_author_base('writers');
After this you have to reset permalinks to see it working.
Remove a custom post type permalink
JigsawPermalinks::remove_permalink_slug($custom_post_type);
JigsawPermalinks::remove_permalink_slug('event');
or
JigsawPermalinks::remove_permalink_slug(array('event', 'book', 'my_other_cpt'));
Set a custom permalink
JigsawPermalinks::set_permalink($post_type, $structure);
JigsawPermalinks::set_permalink('gallery', '/galleries/%year%/%gallery%');
upstatement/jigsaw 适用场景与选型建议
upstatement/jigsaw 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.39k 次下载、GitHub Stars 达 156, 最近一次更新时间为 2016 年 11 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「wordpress」 「tweaks」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 upstatement/jigsaw 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 upstatement/jigsaw 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 upstatement/jigsaw 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Several CMS usability improvements
2lenet/EasyAdminPlusBundle
Analysis module for finding problematical shop data.
Inline/tiled images in a Silverstripe GridField table
Some minor silverstripe tweaks that I use repeatedly on projects
Custom SilverStripe tweaks to keep things tidy.
统计信息
- 总下载量: 3.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 156
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-04
