Switch language

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




language_attributes [ WordPress Function ]

language_attributes ( $doctype = 'html' )
Parameters:
  • (string) $doctype The type of html document (xhtml|html).
Defined at:



Display the language attributes for the html tag.

Builds up a set of html attributes containing the text direction and language information for the page.

Source


<?php
function language_attributes($doctype 'html') {
    
$attributes = array();
    
$output '';

    if ( 
function_exists'is_rtl' ) )
        
$attributes[] = 'dir="' . ( is_rtl() ? 'rtl' 'ltr' ) . '"';

    if ( 
$lang get_bloginfo('language') ) {
        if ( 
get_option('html_type') == 'text/html' || $doctype == 'html' )
            
$attributes[] = "lang=\"$lang\"";

        if ( 
get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
            
$attributes[] = "xml:lang=\"$lang\"";
    }

    
$output implode(' '$attributes);
    
$output apply_filters('language_attributes'$output);
    echo 
$output;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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