Created
June 5, 2023 17:31
-
-
Save bdeleasa/6df493b17adf87850b18787bfefde0f3 to your computer and use it in GitHub Desktop.
Adjust the .elementor-background-overlay element with a PHP filter to add the role="img" attribute for accessibility purposes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'elementor/frontend/the_content', 'MYPREFIX_add_role_to_elementor_overlay' ); | |
/** | |
* Find the <div class="elementor-background-overlay"></div> element and add the role="img" attribute | |
* to meet accessibility guidelines. | |
* | |
* @since 1.0.0 | |
* | |
* @param $content | |
* @return string | |
*/ | |
function MYPREFIX_add_role_to_elementor_overlay($content) { | |
$content = str_replace('<div class="elementor-background-overlay">', '<div class="elementor-background-overlay" role="img">', $content); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment