WPML Coding API
WPML Hooks API
WPML 3.2 offers filter and action hooks that can be used in your WordPress theme or plugin to provide correct multilingual support. Browse the Hooks Reference API for details of each hook
Language constants
WPML defines the following constants which can be used in the theme:
| Constant | Description | Example |
|---|---|---|
| ICL_LANGUAGE_CODE | Code for the current language | fr |
| ICL_LANGUAGE_NAME | Name of current language, in the current language | Français |
| ICL_LANGUAGE_NAME_EN | Name of the current language name in English | French |
Disabling WPML’s CSS and JS files
WPML comes with its own CSS and JS files that style its navigation and drop-down language switcher.
If you don’t need them in your theme, you can tell WPML not to load these files. Do to that, define the following constants in your theme:
| Constant | The file it disables |
|---|---|
| ICL_DONT_LOAD_NAVIGATION_CSS | Navigation stylesheets – cms-navigation-base.css and cms-navigation.css |
| ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS | Drop-down language selector stylesheet – language-selector.css |
| ICL_DONT_LOAD_LANGUAGES_JS | Drop-down language selector Javascript – sitepress.js |
To set these constants, define them in the theme’s functions.php file. For example:
define('ICL_DONT_LOAD_NAVIGATION_CSS', true);