Ticket #16463: the_title_attribute_fix.php
| File the_title_attribute_fix.php, 397 bytes (added by facemann_ru, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | function the_title_attribute( $args = '' ) { |
| 2 | $title = get_the_title(); |
| 3 | |
| 4 | if ( strlen($title) == 0 ) |
| 5 | return; |
| 6 | |
| 7 | $defaults = array('before' => '', 'after' => '', 'echo' => true); |
| 8 | $r = wp_parse_args($args, $defaults); |
| 9 | extract( $r, EXTR_SKIP ); |
| 10 | |
| 11 | |
| 12 | $title = esc_attr(strip_tags($title)); |
| 13 | $title = $before . $title . $after; |
| 14 | |
| 15 | if ( $echo ) |
| 16 | echo $title; |
| 17 | else |
| 18 | return $title; |
| 19 | } |
