webdevstudios/cpt-core
Composer 安装命令:
composer require webdevstudios/cpt-core
包简介
WordPress Custom Post Type OO wrapper
关键字:
README 文档
README
A tool to make custom post type registration just a bit simpler. Automatically registers post type labels and messages, and provides helpful methods.
Also see Taxonomy_Core.
The simple way:
<?php /** * Load CPT_Core. */ require_once 'CPT_Core/CPT_Core.php'; /** * Will register a 'Q & A' CPT */ register_via_cpt_core( array( __( 'Q & A', 'your-text-domain' ), // Singular __( 'Q & As', 'your-text-domain' ), // Plural 'q-and-a-items' // Registered name/slug ) );
The object-oriented way!
<?php /** * Load CPT_Core. */ require_once 'CPT_Core/CPT_Core.php'; /** * Creating a custom class allows you to override core methods, like CPT_Core::columns, and CPT_Core::columns_display */ class Actress_CPT extends CPT_Core { /** * Register Custom Post Types. See documentation in CPT_Core, and in wp-includes/post.php */ public function __construct() { // Register this cpt // First parameter should be an array with Singular, Plural, and Registered name parent::__construct( array( __( 'Actress', 'your-text-domain' ), __( 'Actresses', 'your-text-domain' ), 'film-actress' ), array( 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ), ) ); } /** * Registers admin columns to display. Hooked in via CPT_Core. * @since 0.1.0 * @param array $columns Array of registered column names/labels * @return array Modified array */ public function columns( $columns ) { $new_column = array( 'headshot' => sprintf( __( '%s Headshot', 'your-text-domain' ), $this->post_type( 'singular' ) ), ); return array_merge( $new_column, $columns ); } /** * Handles admin column display. Hooked in via CPT_Core. * @since 0.1.0 * @param array $column Array of registered column names */ public function columns_display( $column, $post_id ) { switch ( $column ) { case 'headshot': the_post_thumbnail(); break; } } } new Actress_CPT();
webdevstudios/cpt-core 适用场景与选型建议
webdevstudios/cpt-core 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7.69k 次下载、GitHub Stars 达 78, 最近一次更新时间为 2015 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「plugin」 「wordpress」 「metabox」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 webdevstudios/cpt-core 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 webdevstudios/cpt-core 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 webdevstudios/cpt-core 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
Custom field for CMB2 which adds a post-search dialog for searching/attaching other post IDs.
CMB2 is a metabox, custom fields, and forms library for WP that will blow your mind.
Framework-agnostic WordPress options manager using custom post types. Supports ACF, custom metaboxes, and extensible integrations.
Plugin for YOURLS. Default tools to use in some laemmi plugins
Helps in a new metabox creation in Wordpress.
统计信息
- 总下载量: 7.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 80
- 点击次数: 21
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPLv2
- 更新时间: 2015-02-27