feat(projects): add single-projects detail template

This commit is contained in:
Keith Solomon
2026-08-16 12:54:38 -05:00
parent 5ab42f02ab
commit 353030d2dc
6 changed files with 282 additions and 15 deletions
+13 -7
View File
@@ -2,23 +2,29 @@
/**
* Project Stat Card Component
*
* Renders one stat tile. Expects $label, $value, and $icon (optional SVG
* markup) in scope. $icon MUST be aria-hidden decorative markup; the label
* is the accessible name.
* Renders one stat tile. Reads $label, $value, and optional $icon from
* get_query_var(), because get_template_part() does not forward its $args
* parameter into the partial's local scope. $icon MUST be aria-hidden
* decorative markup; the label is the accessible name.
*
* @package KsPortfolio
*/
namespace KsPortfolio;
if ( ! isset( $label ) || ! isset( $value ) ) {
$stat_label = get_query_var( 'label' );
$stat_value = get_query_var( 'value' );
$icon = get_query_var( 'icon' );
if ( ! isset( $stat_label ) || ! isset( $stat_value ) ) {
return;
}
$stat_label = (string) $label;
$stat_value = (string) $value;
$stat_label = (string) $stat_label;
$stat_value = (string) $stat_value;
?>
<div class="stat-card" role="group" aria-label="<?php echo esc_attr( $stat_label ); ?>">
<?php if ( isset( $icon ) && $icon ) : ?>
<?php if ( ! empty( $icon ) ) : ?>
<span class="stat-card__icon" aria-hidden="true"><?php echo $icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- icon is hardcoded decorative SVG in callers. ?></span>
<?php endif; ?>
<span class="stat-card__value"><?php echo esc_html( $stat_value ); ?></span>