Site icon Grace Themes

Reply To: Social Care Pro, Feature request to add Alt text to Home Page images

Hey Again: For example you have 4 shortcode in inc/custom-functions.php that are something like the following:
	extract(shortcode_atts(array(
	'image'	=> '',
	'title'	=> '',
        ...
	), $atts));
	return '
        ...
		'<img src="'.$image.'" alt="" />'
If the above is changed to the following, then you would have a more ADA compliant theme with alt text:
	extract(shortcode_atts(array(
	'image'	=> '',
	'alt'	=> '',
	'title'	=> '',
        ...
	), $atts));
        if( $alt =='' ) {
            $alt = $title;
        }
	return '
        ...
		'<img src="'.$image.'" alt="'.$alt.'" />'
Additionally, with parent themes, it’s good practice to make your functions pluggable so that you can easily override them in child themes. This simply means to wrap them in a conditional tag with PHP’s function_exists() to check if a function with that name has already been run. Thanks, Phil
Exit mobile version