Files
Malin f3ff7b7186 feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme
- Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto
- Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold
- Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI)
- Plugins: Kadence Blocks, Polylang, Contact Form 7
- Custom CSS with full brand styling and responsive layout
- HTTPS enforced via wp-config.php proxy detection
2026-05-19 19:25:59 +02:00

79 lines
2.1 KiB
PHP

<?php
/**
* Kadence\Accessibility\Component class
*
* @package kadence
*/
namespace Kadence\Accessibility;
use Kadence\Component_Interface;
use function Kadence\kadence;
use WP_Post;
use function add_action;
use function add_filter;
use function wp_enqueue_script;
use function get_theme_file_uri;
use function get_theme_file_path;
use function wp_script_add_data;
use function wp_localize_script;
/**
* Class for improving accessibility among various core features.
*/
class Component implements Component_Interface {
/**
* Gets the unique identifier for the theme component.
*
* @return string Component slug.
*/
public function get_slug() : string {
return 'accessibility';
}
/**
* Adds the action and filter hooks to integrate with WordPress.
*/
public function initialize() {
add_filter( 'nav_menu_link_attributes', array( $this, 'filter_nav_menu_link_attributes_aria_current' ), 10, 2 );
add_filter( 'page_menu_link_attributes', array( $this, 'filter_nav_menu_link_attributes_aria_current' ), 10, 2 );
add_filter( 'kadence_before_header', array( $this, 'skip_to_content_link' ), 2 );
}
/**
* Prints a link to allow screen readers to skip to content.
*/
public function skip_to_content_link() {
?>
<a class="skip-link screen-reader-text scroll-ignore" href="#main"><?php esc_html_e( 'Skip to content', 'kadence' ); ?></a>
<?php
}
/**
* Filters the HTML attributes applied to a menu item's anchor element.
*
* Checks if the menu item is the current menu item and adds the aria "current" attribute.
*
* @param array $atts The HTML attributes applied to the menu item's `<a>` element.
* @param object $item The current menu item.
* @return array Modified HTML attributes
*/
public function filter_nav_menu_link_attributes_aria_current( array $atts, $item ) {
if ( isset( $item->current ) ) {
if ( $item->current ) {
$atts['aria-current'] = 'page';
}
} elseif ( ! empty( $item->ID ) ) {
global $post;
if ( ! empty( $post->ID ) && (int) $post->ID === (int) $item->ID ) {
$atts['aria-current'] = 'page';
}
}
return $atts;
}
}