fix: remove peptide_topic from CPT class, bring under 300 lines
This commit is contained in:
@@ -5,8 +5,7 @@ declare(strict_types=1);
|
|||||||
* Registers the peptide custom post type and associated taxonomies.
|
* Registers the peptide custom post type and associated taxonomies.
|
||||||
*
|
*
|
||||||
* What: Defines the peptide CPT with REST support, archive, and monograph meta fields.
|
* What: Defines the peptide CPT with REST support, archive, and monograph meta fields.
|
||||||
* Also registers the peptide_category taxonomy (for peptide categorization) and
|
* Also registers the peptide_category taxonomy (for peptide categorization).
|
||||||
* peptide_topic taxonomy (for linking blog posts to peptides).
|
|
||||||
* Who calls it: PR_Core::init() on plugins_loaded.
|
* Who calls it: PR_Core::init() on plugins_loaded.
|
||||||
* Dependencies: None.
|
* Dependencies: None.
|
||||||
*
|
*
|
||||||
@@ -17,9 +16,9 @@ declare(strict_types=1);
|
|||||||
* deploy order between the two plugins does not matter — whichever runs first
|
* deploy order between the two plugins does not matter — whichever runs first
|
||||||
* wins, the other no-ops.
|
* wins, the other no-ops.
|
||||||
*
|
*
|
||||||
* As of v0.3.0, `peptide_topic` taxonomy is registered for linking blog posts
|
* As of v0.3.0, `peptide_topic` taxonomy is registered in a separate class
|
||||||
* to peptides via a shared topic slug (e.g., 'bpc-157'). This enables the
|
* (PR_Core_Topic_Taxonomy) for linking blog posts to peptides via a shared
|
||||||
* Related Articles feature.
|
* topic slug (e.g., 'bpc-157'). This enables the Related Articles feature.
|
||||||
*
|
*
|
||||||
* @see ARCHITECTURE.md — CPT specification and post-meta field definitions.
|
* @see ARCHITECTURE.md — CPT specification and post-meta field definitions.
|
||||||
* @see CONVENTIONS.md — CPT ownership rule (no plugin registers a CPT another plugin owns).
|
* @see CONVENTIONS.md — CPT ownership rule (no plugin registers a CPT another plugin owns).
|
||||||
@@ -32,9 +31,6 @@ class PR_Core_Peptide_CPT {
|
|||||||
/** @var string Taxonomy: category (e.g., GLP-1 agonist). */
|
/** @var string Taxonomy: category (e.g., GLP-1 agonist). */
|
||||||
public const TAX_CATEGORY = 'peptide_category';
|
public const TAX_CATEGORY = 'peptide_category';
|
||||||
|
|
||||||
/** @var string Taxonomy: topic (links blog posts to peptides by slug). */
|
|
||||||
public const TAX_TOPIC = 'peptide_topic';
|
|
||||||
|
|
||||||
/** @var string Capability required for editing peptide data. */
|
/** @var string Capability required for editing peptide data. */
|
||||||
public const CAPABILITY = 'manage_peptide_content';
|
public const CAPABILITY = 'manage_peptide_content';
|
||||||
|
|
||||||
@@ -207,7 +203,7 @@ class PR_Core_Peptide_CPT {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the `peptide_category` and `peptide_topic` taxonomies.
|
* Register the `peptide_category` taxonomy.
|
||||||
*
|
*
|
||||||
* Guarded with `taxonomy_exists()` for the same reason CPT registration
|
* Guarded with `taxonomy_exists()` for the same reason CPT registration
|
||||||
* is guarded. The 8 existing category terms + term_relationships stay intact —
|
* is guarded. The 8 existing category terms + term_relationships stay intact —
|
||||||
@@ -217,11 +213,9 @@ class PR_Core_Peptide_CPT {
|
|||||||
* v0.2.0: `pr_peptide_family` taxonomy removed — never populated, never
|
* v0.2.0: `pr_peptide_family` taxonomy removed — never populated, never
|
||||||
* surfaced in UI.
|
* surfaced in UI.
|
||||||
*
|
*
|
||||||
* v0.3.0: `peptide_topic` taxonomy added. Non-hierarchical, linked to posts,
|
* v0.3.0: `peptide_topic` taxonomy moved to PR_Core_Topic_Taxonomy class.
|
||||||
* uses peptide slugs as terms (e.g., 'bpc-157', 'tb-500'). Enables the Related
|
|
||||||
* Articles feature for blog posts tagged with a peptide topic.
|
|
||||||
*
|
*
|
||||||
* Side effects: registers taxonomies with WordPress.
|
* Side effects: registers taxonomy with WordPress.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -242,23 +236,6 @@ class PR_Core_Peptide_CPT {
|
|||||||
'rewrite' => [ 'slug' => 'peptide-category', 'with_front' => false ],
|
'rewrite' => [ 'slug' => 'peptide-category', 'with_front' => false ],
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register peptide_topic taxonomy (for blog post tagging).
|
|
||||||
if ( ! taxonomy_exists( self::TAX_TOPIC ) ) {
|
|
||||||
register_taxonomy( self::TAX_TOPIC, 'post', [
|
|
||||||
'labels' => [
|
|
||||||
'name' => __( 'Peptide Topics', 'peptide-repo-core' ),
|
|
||||||
'singular_name' => __( 'Peptide Topic', 'peptide-repo-core' ),
|
|
||||||
],
|
|
||||||
'public' => true,
|
|
||||||
'publicly_queryable' => true,
|
|
||||||
'show_in_rest' => true,
|
|
||||||
'show_ui' => true,
|
|
||||||
'show_admin_column' => true,
|
|
||||||
'hierarchical' => false,
|
|
||||||
'rewrite' => [ 'slug' => 'peptide-topic', 'with_front' => false ],
|
|
||||||
] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user