Squash-merge of PR #22: adopt shared reusable CI workflow, convert PHPUnit to stubs, update branch-protection contexts.
QA-approved at 05d8094a1d. All required CI checks green.
Agent-Session: 2026-06-17-prcore-ci-deploy
100 lines
3.0 KiB
PHP
Executable File
100 lines
3.0 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Repo Daily Cpt.
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* Defines the `repo_daily` CPT for articles, guides, comparisons, and news
|
|
*
|
|
* @package Peptide_Repo_Core
|
|
*/
|
|
|
|
/**
|
|
* 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 {
|
|
|
|
/**
|
|
* Post type slug (repo_daily).
|
|
*
|
|
* @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', array( __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 = array(
|
|
'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 = array(
|
|
'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' => array(
|
|
'slug' => 'daily',
|
|
'with_front' => false,
|
|
),
|
|
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields' ),
|
|
);
|
|
|
|
register_post_type( self::POST_TYPE, $args );
|
|
}
|
|
}
|