Definition:
function the_title_attribute( $args = '' ) {}
Sanitize the current title when retrieving or displaying.
Works like the_title(), except the parameters can be in a string or an array. See the function for what can be override in the $args parameter.
Parameters
- string|array $args: Optional. Override the defaults.
Return values
returns:Null on failure or display. String when echo is false.
Source code
function the_title_attribute( $args = '' ) {
$title = get_the_title();
if ( strlen($title) == 0 )
return;
$defaults = array('before' => '', 'after' => '', 'echo' => true);
$r = wp_parse_args($args, $defaults);
extract( $r, EXTR_SKIP );
$title = $before . $title . $after;
$title = esc_attr(strip_tags($title));
if ( $echo )
echo $title;
else
return $title;
}
3053

February 12, 2011 


No comments yet... Be the first to leave a reply!