- Register repo_daily CPT at /daily/[slug]/ for editorial publications - Register repo_daily_category taxonomy with 4 seeded terms - Add Repo Daily metabox for author byline and clinical review flag - Bulk-migrate _repo_daily_author on autoblogged posts (psa_source) - Update ARCHITECTURE.md with content-type table and scanner scope - Update CONVENTIONS.md with repo_daily meta field extension pattern - Bump version to 0.5.0, add CHANGELOG entry Closes v0.5.0 scope.
81 lines
2.7 KiB
PHP
Executable File
81 lines
2.7 KiB
PHP
Executable File
<?php
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Registers the repo_daily custom post type for editorial publications.
|
|
*
|
|
* What: Defines the `repo_daily` CPT for articles, guides, comparisons, and news
|
|
* generated by PRAutoBlogger and published under the Boo Sheeran byline.
|
|
* Who calls it: PR_Core::init() on plugins_loaded.
|
|
* Dependencies: None.
|
|
*
|
|
* Posts register at /daily/[slug]/ with title, editor, excerpt, thumbnail,
|
|
* and custom-fields support. REST-enabled for programmatic access by
|
|
* PRAutoBlogger and other integrations.
|
|
*
|
|
* @see ARCHITECTURE.md — Repo Daily type specification.
|
|
* @see CONVENTIONS.md — CPT ownership and extension patterns.
|
|
*/
|
|
class PR_Core_Repo_Daily_CPT {
|
|
|
|
/** @var string Post type slug (repo_daily). */
|
|
public const POST_TYPE = 'repo_daily';
|
|
|
|
/**
|
|
* Register WordPress hooks for CPT registration.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register_hooks(): void {
|
|
add_action( 'init', [ __CLASS__, 'register_post_type' ] );
|
|
}
|
|
|
|
/**
|
|
* Register the `repo_daily` custom post type.
|
|
*
|
|
* Side effects: registers CPT with WordPress.
|
|
*
|
|
* @return void
|
|
*/
|
|
public static function register_post_type(): void {
|
|
if ( post_type_exists( self::POST_TYPE ) ) {
|
|
return;
|
|
}
|
|
|
|
$labels = [
|
|
'name' => __( 'Repo Daily', 'peptide-repo-core' ),
|
|
'singular_name' => __( 'Repo Daily', 'peptide-repo-core' ),
|
|
'add_new_item' => __( 'Add New Article', 'peptide-repo-core' ),
|
|
'edit_item' => __( 'Edit Article', 'peptide-repo-core' ),
|
|
'new_item' => __( 'New Article', 'peptide-repo-core' ),
|
|
'view_item' => __( 'View Article', 'peptide-repo-core' ),
|
|
'search_items' => __( 'Search Articles', 'peptide-repo-core' ),
|
|
'not_found' => __( 'No articles found', 'peptide-repo-core' ),
|
|
'not_found_in_trash' => __( 'No articles found in trash', 'peptide-repo-core' ),
|
|
'all_items' => __( 'All Articles', 'peptide-repo-core' ),
|
|
'menu_name' => __( 'Repo Daily', 'peptide-repo-core' ),
|
|
];
|
|
|
|
$args = [
|
|
'labels' => $labels,
|
|
'public' => true,
|
|
'publicly_queryable' => true,
|
|
'show_ui' => true,
|
|
'show_in_menu' => true,
|
|
'show_in_nav_menus' => true,
|
|
'show_in_rest' => true,
|
|
'rest_base' => 'repo_daily',
|
|
'menu_position' => 6,
|
|
'menu_icon' => 'dashicons-edit-page',
|
|
'capability_type' => 'post',
|
|
'map_meta_cap' => true,
|
|
'hierarchical' => false,
|
|
'has_archive' => true,
|
|
'rewrite' => [ 'slug' => 'daily', 'with_front' => false ],
|
|
'supports' => [ 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields' ],
|
|
];
|
|
|
|
register_post_type( self::POST_TYPE, $args );
|
|
}
|
|
}
|