Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




the_title_attribute [ WordPress Function ]

the_title_attribute ( $args = '' )
Parameters:
  • (string|array) $args Optional. Override the defaults.
Returns:
  • (string|null) Null on failure or display. String when echo is false.
Defined at:



Sanitize the current title when retrieving or displaying.

Works like {@link 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.

The title before it is displayed will have the tags stripped and {@link esc_attr()} before it is passed to the user or displayed. The default as with {@link the_title()}, is to display the title.

Source


<?php
function the_title_attribute$args '' ) {
    
$title get_the_title();

    if ( 
strlen($title) == )
        return;

    
$defaults = array('before' => '''after' =>  '''echo' => true);
    
$r wp_parse_args($args$defaults);
    
extract$rEXTR_SKIP );

    
$title $before $title $after;
    
$title esc_attr(strip_tags($title));

    if ( 
$echo )
        echo 
$title;
    else
        return 
$title;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics