WPML offers functions that can be used in your WordPress theme to provide correct support for multilingual themes.

Function Purpose Notes
do_action(‘icl_language_selector’) Insert the drop down language selector. Described in the language setupsection of the getting started guide.
do_action(‘icl_navigation_menu’) Insert the top navigation menu. Described in the navitaion section of the getting started guide.
do_action(‘icl_navigation_breadcrumb’) Insert the breadcrumbs trail.
do_action(‘icl_navigation_sidebar’) Insert the sidebar navigation.
icl_get_home_url() Link to the home page in the active language. Described in the home page linksection of the getting started guide.
icl_get_languages(‘skip_missing=N’) Used for building custom language selectors. Described in the custom language switcher section of the getting started guide.
icl_link_to_element(ID, type, text, arguments, anchor) Used for creating language dependent links in themes. Described in the hard coded linkssection of the getting started guide.
icl_object_id(ID, type, return_original_if_missing, language_code) Used for calculating the IDs of objects (usually categories) in the current language. Described in the language dependent IDs section of the getting started guide.
icl_register_string(context, name, value) Registers a string for translation Described in the guide fortranslating texts in other plugins and themes.
icl_unregister_string(context, name) Removes a string from the translation table
icl_t(context, name, value) Gets the translated value of a string.

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);
define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
define('ICL_DONT_LOAD_LANGUAGES_JS', true);

592 thoughts on “WPML Coding API

  1. Kelebihan Oppo

    Hiya, I am really glad I have found this info. Nowadays bloggers publish only about gossip and net stuff and this is really annoying. A good blog with interesting content, this is what I need. Thanks for making this web site, and I’ll be visiting again. Do you do newsletters by email?

  2. Renovation

    I¡¦ve read some good stuff here. Certainly value bookmarking for revisiting. I surprise how so much attempt you put to make this sort of great informative web site.

  3. Homeserve USA

    We are a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You have done a formidable job and our entire community will be thankful to you.

  4. Home Warranty Companies

    excellent submit, very informative. I wonder why the opposite experts of this sector don’t notice this. You must continue your writing. I’m confident, you’ve a huge readers’ base already!

  5. pedophile

    Hello, i think that i noticed you visited my weblog so i came to return the prefer?.I’m attempting to find issues to improve my web site!I suppose its good enough to use a few of your concepts!!

  6. youtube apk

    Awesome write-up. I am a normal visitor of your website and appreciate you taking the time to maintain the excellent site. I will be a frequent visitor for a really long time.

  7. lebahratu

    Awesome post. I’m a regular visitor of your blog and appreciate you taking the time to maintain the excellent site. I will be a frequent visitor for a long time.

  8. Harga Rumput Sintetis outdor

    Hiya, I’m really glad I have found this information. Nowadays bloggers publish only about gossip and web stuff and this is actually annoying. A good site with interesting content, that is what I need. Thanks for making this site, and I will be visiting again. Do you do newsletters by email?

  9. jual rumput sintetis dekorasi

    Hiya, I’m really glad I’ve found this information. Today bloggers publish just about gossip and internet stuff and this is actually irritating. A good site with exciting content, that is what I need. Thank you for making this website, and I’ll be visiting again. Do you do newsletters by email?

  10. Teak furniture

    Hi there. I found your website by means of Google even as looking for a similar topic, your website got here up. It appears good. I’ve bookmarked it in my google bookmarks to visit then.

  11. taruhan bola online

    Hiya, I’m really glad I’ve found this info. Nowadays bloggers publish only about gossip and net stuff and this is really frustrating. A good web site with exciting content, this is what I need. Thank you for making this website, and I will be visiting again. Do you do newsletters by email?

  12. situs judi bola

    Awesome write-up. I’m a normal visitor of your website and appreciate you taking the time to maintain the nice site. I will be a frequent visitor for a really long time.

  13. yahotogel

    Awesome post. I’m a normal visitor of your blog and appreciate you taking the time to maintain the excellent site. I will be a frequent visitor for a long time.

  14. parfum laundry

    Awesome write-up. I am a normal visitor of your blog and appreciate you taking the time to maintain the nice site. I will be a regular visitor for a really long time.

  15. Fashion & Shopping

    Hello there, just became aware of your blog through Google, and found that it’s truly informative. I’m going to watch out for brussels. I’ll appreciate if you continue this in future. Numerous people will be benefited from your writing. Cheers!

  16. Business Owner

    My brother suggested I might like this website. He was totally right. This post actually made my day. You can not imagine just how much time I had spent for this information! Thanks!

  17. gesek tunai

    Awesome post. I am a regular visitor of your web site and appreciate you taking the time to maintain the excellent site. I’ll be a frequent visitor for a long time.

  18. Cheap Car Leasing

    What i do not understood is in reality how you’re not really a lot more smartly-liked than you may be now. You’re so intelligent. You know thus significantly relating to this topic, produced me individually consider it from a lot of various angles. Its like women and men don’t seem to be fascinated except it is something to accomplish with Girl gaga! Your personal stuffs nice. Always take care of it up!

  19. Attorney

    I loved as much as you will receive carried out right here. The sketch is attractive, your authored subject matter stylish. nonetheless, you command get got an shakiness over that you wish be delivering the following. unwell unquestionably come more formerly again as exactly the same nearly a lot often inside case you shield this hike.

  20. Bandar Togel

    Awesome write-up. I am a normal visitor of your website and appreciate you taking the time to maintain the nice site. I’ll be a frequent visitor for a long time.

  21. Law Firms

    I was recommended this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed about my problem. You are incredible! Thanks!

  22. Car Book Value

    Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to far added agreeable from you! However, how can we communicate?

  23. togel online

    Hiya, I’m really glad I have found this information. Nowadays bloggers publish only about gossip and web stuff and this is really frustrating. A good web site with interesting content, this is what I need. Thanks for making this web site, and I will be visiting again. Do you do newsletters by email?

  24. Check this Post

    Does your website have a contact page? I’m having a tough time locating itt but, I’d like to send you an e-mail.
    I’ve got soje recommendations for your blog you might be interested in hearing.

    Eituer way, great site annd I look forward to seeing it grow over time.

  25. The Business

    wonderful put up, very informative. I wonder why the other specialists of this sector do not understand this. You should continue your writing. I am sure, you have a huge readers’ base already!

  26. website

    It’s really a cool and helpful piece of info. I am glad that yyou simply shared his useful
    information with us. Please keep us informed like this.
    Thanks for sharing.

  27. Car Specials

    I wanted to send you a very small remark to say thank you over again for these spectacular things you’ve documented here. This is really extremely open-handed of people like you to present freely what a few individuals would have offered for sale as an e book in making some profit for their own end, precisely given that you might well have tried it if you considered necessary. These principles in addition worked to be the great way to realize that other people have the identical eagerness just like my very own to learn much more when considering this condition. I believe there are millions of more enjoyable occasions in the future for individuals that find out your site.

  28. dominoqq

    Awesome write-up. I’m a normal visitor of your site and appreciate you taking the time to maintain the nice site. I’ll be a frequent visitor for a long time.

  29. this Blog Page

    Hello I am so glad I found your weblog, I really found you by mistake, whole I was browsing
    oon Aol for something else, Anyhow I am here
    now and would just like to say kudos ffor a marvelous
    post and a all round enjoyable blog (I allso love the theme/design), I don’t have time to
    browse it all aat the minute but I hav saved it and also included your RSS feeds, so when I have timme Iwill be ack to red a lot more, Please do keep up the great
    work.

  30. Statutory

    I haven¡¦t checked in here for some time because I thought it was getting boring, but the last few posts are good quality so I guess I¡¦ll add you back to my daily bloglist. You deserve it my friend 🙂

  31. Law Firms

    I must express appreciation to you for rescuing me from this circumstance. Right after surfing around throughout the internet and finding tricks which were not productive, I believed my entire life was done. Being alive without the presence of answers to the issues you have fixed through your good short article is a serious case, as well as those that might have adversely affected my career if I had not discovered your blog post. The understanding and kindness in taking care of all the pieces was priceless. I am not sure what I would have done if I had not discovered such a point like this. I am able to at this moment relish my future. Thank you very much for your expert and effective help. I won’t be reluctant to suggest the sites to anybody who needs and wants care about this situation.

  32. Car Specials

    I¡¦ve learn some just right stuff here. Definitely price bookmarking for revisiting. I wonder how a lot effort you set to create this type of great informative web site.

  33. Solicitor

    Hi, Neat post. There’s a problem along with your site in web explorer, may test this¡K IE nonetheless is the marketplace chief and a huge element of folks will miss your great writing due to this problem.

  34. Ayam Jago Aduan

    Hello there. I discovered your web site by means of Google even as searching for a related topic, your website got here up. It looks good. I have bookmarked it in my google bookmarks to come back then.

  35. mebel jepara

    Awesome post. I’m a regular visitor of your web site and appreciate you taking the time to maintain the excellent site. I will be a frequent visitor for a really long time.

发表评论