It seems you are dealing with duplicated content in the form of the site title and its corresponding aria-label
attribute. To address this issue without creating a child theme, you can leverage JavaScript to dynamically manipulate the aria-label
attribute based on the user’s accessibility needs.
Here’s a simple script you can add to your WordPress site:
<script>
document.addEventListener('DOMContentLoaded', function () {
// Get the site title element
var siteTitle = document.querySelector('.site-logo .site-title');
// Check if a screen reader is active
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
// Set aria-label to an empty string if a screen reader is active
siteTitle.setAttribute('aria-label', '');
}
});
</script>
This script checks if a screen reader is active and, if so, sets the aria-label
attribute of the site title to an empty string. This way, screen readers will skip reading the duplicated content when accessibility features are in use.
Make sure to insert this script in the appropriate section of your WordPress theme, such as the footer or within the <head>
section. You can do this by adding the script directly to your theme’s customization options or by using a custom JavaScript plugin.
Remember to test the solution thoroughly to ensure it meets your accessibility requirements.