feat(projects): add single-projects detail template
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user