Projects were hardcoded h3 elements in a pattern: no URL, no feed, no search, uneditable without touching PHP. They follow the podcast model now, a chrnx_topic term plus posts. Adds a chrnx_project_featured flag with an editor toggle so the stage lists chosen projects first and fills with the most recent. Sticky was already spoken for by the home featured stories, so the choice needed its own signal. journal-stream gains a pinned topic attribute, reusing the archive filter, pagination and empty state it already had. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
38 lines
960 B
PHP
38 lines
960 B
PHP
<?php
|
|
/**
|
|
* Project post metadata.
|
|
*
|
|
* @package CHRNX
|
|
*/
|
|
|
|
/**
|
|
* Require permission to edit the post owning project metadata.
|
|
*
|
|
* @param bool $allowed Previously calculated permission.
|
|
* @param string $meta_key Metadata key.
|
|
* @param int $post_id Post ID.
|
|
* @return bool Whether the current user can edit the post.
|
|
*/
|
|
function chrnx_auth_project_meta( $allowed, $meta_key, $post_id ) {
|
|
return current_user_can( 'edit_post', $post_id );
|
|
}
|
|
|
|
/**
|
|
* Register project metadata for posts.
|
|
*/
|
|
function chrnx_register_project_meta() {
|
|
register_post_meta(
|
|
'post',
|
|
'chrnx_project_featured',
|
|
array(
|
|
'type' => 'boolean',
|
|
'single' => true,
|
|
'default' => false,
|
|
'show_in_rest' => array( 'schema' => array( 'type' => 'boolean' ) ),
|
|
'sanitize_callback' => 'rest_sanitize_boolean',
|
|
'auth_callback' => 'chrnx_auth_project_meta',
|
|
)
|
|
);
|
|
}
|
|
add_action( 'init', 'chrnx_register_project_meta' );
|