-
Notifications
You must be signed in to change notification settings - Fork 0
Post Types
Daryll Doyle edited this page Mar 13, 2025
·
1 revision
WP Framework provides abstract classes to help define both custom and core post types. This minimizes boilerplate while ensuring consistency.
namespace TenUpPlugin\Posts;
use TenupFramework\PostTypes\AbstractPostType;
class Demo extends AbstractPostType {
public function get_name() {
return 'tenup-demo';
}
public function get_singular_label() {
return esc_html__( 'Demo', 'tenup-plugin' );
}
public function get_plural_label() {
return esc_html__( 'Demos', 'tenup-plugin' );
}
public function get_menu_icon() {
return 'dashicons-chart-pie';
}
}
namespace TenUpPlugin\Posts;
use TenupFramework\PostTypes\AbstractCorePostType;
class Post extends AbstractCorePostType {
public function get_name() {
return 'post';
}
public function get_supported_taxonomies() {
return [];
}
public function after_register() {
// No additional functionality.
}
}
- Extend
AbstractPostType
for new content types. - Extend
AbstractCorePostType
to modify or extend built-in types. - Use translation functions for labels.