feat: list every project with its status and links
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
4 files changed
+119
-1
No files matched your search
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Project List block render.
|
||||
*
|
||||
* @package CHRNX
|
||||
*/
|
||||
|
||||
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
|
||||
$chrnx_terms = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'chrnx_project',
|
||||
'hide_empty' => false,
|
||||
)
|
||||
);
|
||||
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<?php
|
||||
foreach ( $chrnx_terms as $chrnx_term ) :
|
||||
$chrnx_link = get_term_link( $chrnx_term );
|
||||
$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 );
|
||||
?>
|
||||
<article class="chrnx-project-card">
|
||||
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
|
||||
<a class="chrnx-project-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
|
||||
<?php endif; ?>
|
||||
<span class="chrnx-project-card__art">
|
||||
<?php if ( $chrnx_cover > 0 ) : ?>
|
||||
<?php echo wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-project-card__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php else : ?>
|
||||
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-project-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||
<?php if ( '' !== $chrnx_status ) : ?>
|
||||
<p class="chrnx-project-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
|
||||
</a>
|
||||
<?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 ?>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
Reference in new issue
Block a user