| 4209 | |
| 4210 | /** |
| 4211 | * Returns two versions of a string, one for sighted users and one for screen reader users. |
| 4212 | * Typically used in situations where design requires a short link that may not provide enough |
| 4213 | * context for a screen reader user. |
| 4214 | * |
| 4215 | * @param string $shortform The short version of the text for for sighted users |
| 4216 | * @param string $longform The long version of the text for screen readers |
| 4217 | * @param string $classname The CSS class to put on the span for screen reader text. Defaults to 'screen-reader-text'. |
| 4218 | * |
| 4219 | * @return string |
| 4220 | * |
| 4221 | * @since |
| 4222 | */ |
| 4223 | function get_a11y_short_long( $shortform, $longform, $classname = 'screen-reader-text' ) { |
| 4224 | return '<span aria-hidden="true">' . $shortform . '</span><span class="' . $classname . '"> ' . $longform . '</span>'; |
| 4225 | } |
| 4226 | |
| 4227 | /** |
| 4228 | * Echos two versions of a string, one for sighted users and one for screen reader users. |
| 4229 | * Typically used in situations where design requires a short link, but that link may not |
| 4230 | * provide enough context for a screen reader user. |
| 4231 | * |
| 4232 | * @param string $shortform The short version of the text for for sighted users |
| 4233 | * @param string $longform The long version of the text for screen readers |
| 4234 | * @param string $classname The CSS class to put on the span for screen reader text. Defaults to 'screen-reader-text'. |
| 4235 | * |
| 4236 | * @see get_a11y_short_long() |
| 4237 | * |
| 4238 | * @since |
| 4239 | */ |
| 4240 | function a11y_short_long( $shortform, $longform, $classname = 'screen-reader-text' ) { |
| 4241 | echo get_a11y_short_long( $shortform, $longform, $classname); |
| 4242 | } |
| 4243 | No newline at end of file |