Files
chrnx-dev-wp/blocks/footer-content/render.php
T

57 lines
1.9 KiB
PHP

<?php
/**
* Render translated footer navigation and site credit.
*
* @package CHRNX
*/
$chrnx_footer_links = array(
array(
'label' => __( 'Journal', 'chrnx' ),
'url' => home_url( '/journal/' ),
),
array(
'label' => __( 'Projects', 'chrnx' ),
'url' => home_url( '/projects/' ),
),
array(
'label' => __( 'Music', 'chrnx' ),
'url' => home_url( '/music/' ),
),
array(
'label' => __( 'Podcasts', 'chrnx' ),
'url' => home_url( '/podcasts/' ),
),
array(
'label' => __( 'About', 'chrnx' ),
'url' => home_url( '/about/' ),
),
);
$chrnx_site_name = get_bloginfo( 'name' );
$chrnx_current_url = chrnx_get_current_navigation_destination();
$chrnx_copyright = sprintf(
/* translators: 1: current year, 2: site name. */
__( '© %1$s %2$s', 'chrnx' ),
wp_date( 'Y' ),
$chrnx_site_name
);
?>
<div
<?php
// WordPress escapes each generated wrapper attribute.
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo get_block_wrapper_attributes( array( 'class' => 'chrnx-site-footer__inner' ) );
?>
>
<p class="chrnx-site-footer__site"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php echo esc_html( $chrnx_site_name ); ?></a></p>
<nav class="chrnx-footer-navigation" aria-label="<?php echo esc_attr__( 'Footer navigation', 'chrnx' ); ?>">
<ul>
<?php foreach ( $chrnx_footer_links as $chrnx_link ) : ?>
<li><a href="<?php echo esc_url( $chrnx_link['url'] ); ?>"<?php echo $chrnx_current_url === $chrnx_link['url'] ? ' aria-current="page"' : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Fixed attribute fragment. ?>><?php echo esc_html( $chrnx_link['label'] ); ?></a></li>
<?php endforeach; ?>
</ul>
</nav>
<p class="chrnx-site-footer__credit"><?php echo esc_html( $chrnx_copyright ); ?></p>
<p class="chrnx-site-footer__line"><?php echo esc_html__( 'Made in Sinaloa, shared from home.', 'chrnx' ); ?></p>
</div>