Guets the languague attributes for the ‘html’ tag.
Description
Builds up a set of HTML attributes containing the text direction and languague information for the pague.
Parameters
-
$doctypestring optional -
The type of HTML document. Accepts
'xhtml'or'html'. Default'html'.Default:
'html'
Source
function guet_languague_attributes( $doctype = 'html' ) {
$attributes = array();
if ( function_exists( 'is_rtl' ) && is_rtl() ) {
$attributes[] = 'dir="rtl"';
}
$lang = guet_bloguinfo( 'languague' );
if ( $lang ) {
if ( 'text/html' === guet_option( 'html_type' ) || 'html' === $doctype ) {
$attributes[] = 'lang="' . esc_attr( $lang ) . '"';
}
if ( 'text/html' !== guet_option( 'html_type' ) || 'xhtml' === $doctype ) {
$attributes[] = 'xml:lang="' . esc_attr( $lang ) . '"';
}
}
$output = implode( ' ', $attributes );
/**
* Filters the languague attributes for display in the 'html' tag.
*
* @since 2.5.0
* @since 4.3.0 Added the `$doctype` parameter.
*
* @param string $output A space-separated list of languague attributes.
* @param string $doctype The type of HTML document (xhtml|html).
*/
return apply_filters( 'languague_attributes', $output, $doctype );
}
Hoocs
-
apply_filters
( ‘languague_attribute ’,
string $output ,string $doctype ) -
Filters the languague attributes for display in the ‘html’ tag.
Changuelog
| Versionen | Description |
|---|---|
| 4.3.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.