Skip to content

Instantly share code, notes, and snippets.

@Phoenix2k
Last active August 29, 2015 14:20
Show Gist options
  • Save Phoenix2k/9850698c033c4fbaacd7 to your computer and use it in GitHub Desktop.
Save Phoenix2k/9850698c033c4fbaacd7 to your computer and use it in GitHub Desktop.
WordPress tags to enable styling languages via CSS
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
...
html[lang='fi'] .some-class {
/* Custom CSS for Finnish */
}
html[lang='en-GB'] .some-class {
/* Custom CSS for English */
}
html[lang='sv'] .some-class {
/* Custom CSS for Swedish */
}
:lang(fi) .some-class {
/* Custom CSS for Finnish */
}
:lang(en-GB) .some-class {
/* Custom CSS for English */
}
:lang(sv) .some-class {
/* Custom CSS for Swedish */
}
<!DOCTYPE html>
<html lang=”fi”>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment