Initial public release of BreznFlow, an n8n workflow renderer for WordPress. Fully PHPCS-compliant (WordPress Coding Standards), security-hardened, and ready for WordPress.org plugin review. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
102 lines
3.1 KiB
PHP
102 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* Custom post type and taxonomy registration.
|
|
*
|
|
* @package BreznFlow
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
namespace BreznFlow;
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Registers the breznflow_workflow post type and breznflow_category taxonomy.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class PostType {
|
|
/**
|
|
* Hooks post type and taxonomy registration into WordPress init.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
public function register(): void {
|
|
add_action( 'init', array( $this, 'register_post_type' ) );
|
|
add_action( 'init', array( $this, 'register_taxonomy' ) );
|
|
}
|
|
|
|
/**
|
|
* Registers the breznflow_workflow custom post type.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
public function register_post_type(): void {
|
|
register_post_type(
|
|
'breznflow_workflow',
|
|
array(
|
|
'labels' => array(
|
|
'name' => __( 'Workflows', 'breznflow' ),
|
|
'singular_name' => __( 'Workflow', 'breznflow' ),
|
|
'add_new' => __( 'Add Workflow', 'breznflow' ),
|
|
'add_new_item' => __( 'Add New Workflow', 'breznflow' ),
|
|
'edit_item' => __( 'Edit Workflow', 'breznflow' ),
|
|
'new_item' => __( 'New Workflow', 'breznflow' ),
|
|
'view_item' => __( 'View Workflow', 'breznflow' ),
|
|
'search_items' => __( 'Search Workflows', 'breznflow' ),
|
|
'not_found' => __( 'No workflows found', 'breznflow' ),
|
|
'not_found_in_trash' => __( 'No workflows found in trash', 'breznflow' ),
|
|
'menu_name' => __( 'BreznFlow', 'breznflow' ),
|
|
),
|
|
'public' => false,
|
|
'show_ui' => true,
|
|
'show_in_menu' => false,
|
|
'show_in_rest' => false,
|
|
'capability_type' => 'post',
|
|
'has_archive' => false,
|
|
'rewrite' => false,
|
|
'supports' => array( 'title', 'author' ),
|
|
'taxonomies' => array( 'breznflow_category' ),
|
|
)
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Registers the breznflow_category taxonomy.
|
|
*
|
|
* @since 1.0.0
|
|
* @return void
|
|
*/
|
|
public function register_taxonomy(): void {
|
|
register_taxonomy(
|
|
'breznflow_category',
|
|
'breznflow_workflow',
|
|
array(
|
|
'labels' => array(
|
|
'name' => __( 'Workflow Categories', 'breznflow' ),
|
|
'singular_name' => __( 'Workflow Category', 'breznflow' ),
|
|
'search_items' => __( 'Search Categories', 'breznflow' ),
|
|
'all_items' => __( 'All Categories', 'breznflow' ),
|
|
'parent_item' => __( 'Parent Category', 'breznflow' ),
|
|
'parent_item_colon' => __( 'Parent Category:', 'breznflow' ),
|
|
'edit_item' => __( 'Edit Category', 'breznflow' ),
|
|
'update_item' => __( 'Update Category', 'breznflow' ),
|
|
'add_new_item' => __( 'Add New Category', 'breznflow' ),
|
|
'new_item_name' => __( 'New Category Name', 'breznflow' ),
|
|
'menu_name' => __( 'Categories', 'breznflow' ),
|
|
),
|
|
'hierarchical' => true,
|
|
'public' => false,
|
|
'show_ui' => true,
|
|
'show_in_menu' => false,
|
|
'show_in_rest' => false,
|
|
'show_admin_column' => true,
|
|
'rewrite' => false,
|
|
)
|
|
);
|
|
}
|
|
}
|