![]() In this method, we are returning the second language as hr which is the Croatian locale. If you want, this method can return directly the $_GET if it’s set and instead of using locale=en, you could use locale=en_US. Let’s now create a method that will check for the locale that we need from the $_GET global. The method get_locale will filter the locale before WordPress loads the default locale. The method set_locale will set the cookie for our language switcher if we have such query parameter. Add this code to the wp-content/plugins/ folder. I’ll create a plugin since it’s easier to remove the code from running. You can add this code in your theme or as a separate plugin.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |