feat: give each project its own page header and post stream
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
5 files changed
+114
-7
No files matched your search
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "chrnx/project-detail",
|
||||
"version": "0.4.4",
|
||||
"title": "Project Detail",
|
||||
"category": "theme",
|
||||
"description": "Cover, status, description and links for the queried project.",
|
||||
"textdomain": "chrnx",
|
||||
"attributes": {},
|
||||
"supports": { "html": false },
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Project Detail block render.
|
||||
*
|
||||
* @package CHRNX
|
||||
*/
|
||||
|
||||
$chrnx_term = get_queried_object();
|
||||
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_project' !== $chrnx_term->taxonomy ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_project_status', true );
|
||||
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_project_cover', true ) );
|
||||
$chrnx_links = chrnx_get_project_links( $chrnx_term->term_id );
|
||||
// Without status, description or links there is no second column to fill.
|
||||
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
|
||||
$chrnx_head_class = 'chrnx-project-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
|
||||
?>
|
||||
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
|
||||
<div class="chrnx-project-detail__art">
|
||||
<?php if ( $chrnx_cover > 0 ) : ?>
|
||||
<?php echo wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-project-detail__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php else : ?>
|
||||
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="chrnx-project-detail__intro">
|
||||
<?php if ( '' !== $chrnx_status ) : ?>
|
||||
<p class="chrnx-project-detail__status"><?php echo esc_html( $chrnx_status ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( '' !== $chrnx_term->description ) : ?>
|
||||
<p class="chrnx-project-detail__description"><?php echo esc_html( $chrnx_term->description ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_project_link_slots() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user