Skip to main content
5 votes
Accepted

Add language/country code to each possible URL

I'm working on a similar solution right now - the website must have language codes in all URLs (except the default language), but only pages are translatable in a way WPML/Polylang plugins do it. For ...
Ihor Vorotnov's user avatar
4 votes
Accepted

How to get shared CSS body class between translated WPML pages

It's not a good practice to use post name to style your page. Maybe you can use template page. But if you still want to do it, you can do something like this: function ...
ZecKa's user avatar
  • 768
3 votes

ACF + WPML: How to translate date fields?

You can use the global $wp_locale to get the month translated in each language. You just need to get the month number (01 to 12) from the Acf field. You have the functions in the WP_Locale class ...
Shibi's user avatar
  • 1,833
3 votes
Accepted

Fetch ID's associated with a custom post type when translated with WPML?

NOTE: I'm not giving a full answer to your question but trying to give some snippets that may help in WPML-based project. I've used this function: function get_the_translated_ID($id){ if (!...
Andrea Somovigo's user avatar
3 votes

How can override a add_filter of a plugin?

Filters come with a priority parameter, the default is 10, so to override a function you need to increase the priority: add_filter( 'wcml_switch_currency_exception', 'cart_switching_currency', 99, 4 )...
Drupalizeme's user avatar
  • 1,616
2 votes

Wordpress multilingual site using page-id.php files

I have developed pages in that manner and if you are using WordPress functions and follow WP Codex it is same situation as if you developed custom page template. Just follow I18n for WordPress ...
Vuk Vukovic's user avatar
2 votes

Comments waiting but no comments found

Try to check on DB level. This SQL should give a list of all spam comments (which I assume skräpposter means): SELECT * FROM `wp_comments` WHERE `comment_approved` = 'spam'; If the SQL gives 0 lines, ...
Bence Szalai's user avatar
2 votes
Accepted

WPML - Filter by individual or all languages

So I've made it work. The problem was not with the filter but with tax query. Here is the solution for those who might be interested. <?php // I check the lang query var if it's empty we'll ...
Pipo's user avatar
  • 609
2 votes

Custom Post Type With Different Views

For example, let's say that Property is the post type. We would like to display several different views (completed (built), for sale, and for rent.) Sure. Just make Completed, For Sale, and For ...
hwl's user avatar
  • 2,135
2 votes

Error 404 using wpml plugin

Sometimes setting your permalinks up and saving them helps solve this kind of problem. Settings-Permalinks-choose your default permalink structure and hit the Save.
Mitos's user avatar
  • 55
2 votes
Accepted

Created pages not showing up in 'All Pages' list

The problem was actually the pages having "no language" and WPML seems to hate this. So I just deleted all those pages and re-inserted them with the proper WPML language attributes: // (...) // ...
GigiSan's user avatar
  • 245
2 votes
Accepted

WPML – PHP Fatal error: Uncaught Error: Call to undefined function str_contains()

To fix it urgently, I had to put a str_contains() polyfill right into wp-config.php: if (!function_exists('str_contains')) { /** * Check if substring is contained in string * * @...
Wadih M.'s user avatar
  • 2,898
1 vote
Accepted

How to translate text in function.php with WPML

It should suffice to add a __() around your translatable text: add_action( 'woocommerce_cart_calculate_fees', 'custom_handling_fee', 10, 1 ); function custom_handling_fee ( $cart ) { if ( ...
Tim's user avatar
  • 126
1 vote
Accepted

Make dynamic string translatable

No, you wouldn't use the translation functions (__(), _e() etc.). Those are for creating language files and must only be used on static strings. They need to be static because the tools for generating ...
Jacob Peattie's user avatar
1 vote
Accepted

ACF + WPML: How to translate date fields?

After a bit more Googling, I finally found what I was looking for, using the WordPress function date_i18n(). It appears to read the language set by WPML and returns the ACF date in the correct ...
dkeeling's user avatar
  • 339
1 vote

Custom Post Type With Different Views

One possible solution is to add a metadata field to your post indicating the status (i.e. completed, for sale or for rent). Then in your template file you call get_post_meta and show the content ...
Pisuke Soramame's user avatar
1 vote

WPML Translating a term/taxonomy programmatically

Ok I found the solution. Actually taxonomy name on icl_translation table is stored with prefix called "tax_" which means taxonomy. The above code would work like this: $trid = $sitepress->...
Agon Xheladini's user avatar
1 vote

How to migrate Custom Field Template to a Wordpress Multisite

You will need to find a way to do import Options programmatically, by hooking wpmu_new_blog. the hook function should switch_to_blog do your Import Options and restore_current_blog.
JBoulhous's user avatar
  • 289
1 vote
Accepted

How to use WPML Plugin in contact form 7

You should create another Contact Form for any different language. You include the form with shortcode, so it's pretty easy to duplicate a form, translate it to given language and then modify the ...
Krzysiek Dróżdż's user avatar
1 vote
Accepted

WPML get permalink to the translated post from the original post

For anyone who is having a similar issue. You'll be able to solve the issue by using wp, wp_head, wp_footer or template_redirect action hooks. In this case, template_redirect action hook solved my ...
madhushankarox's user avatar
1 vote
Accepted

WPML - Set language of inserted post

The wpml_set_element_language_details action element_type need to be with the correct prefix that WPML use: From the WPML Docs element_type(string) The type of an element. Can be a post type: ...
Shibi's user avatar
  • 1,833
1 vote

Create header.php redirect in Wordpress and with WPML

Your code redirects to "/ie/" also if you are already on "/ie/". The easiest way to prevent this is by changing if( $country == 'IE' ) { to if( $country == 'IE' && substr( $_SERVER['...
ahendwh2's user avatar
  • 696
1 vote

How can override a add_filter of a plugin?

You can use remove_filter to remove a filter, and then add your own filter to that hook. For example: remove_filter( 'wcml_switch_currency_exception', 'cart_switching_currency', 10 ); add_filter( '...
Johansson's user avatar
  • 15.3k
1 vote

How to list WP multisite languages

Fix it by querying to wpml languages table. get all sites loop through the sites get blog ids. Query ICL languages table of each blog(each multi-site) Add into Array & play accordingly $...
Noman's user avatar
  • 159
1 vote

ACF Content with WPML not saving

I've had a fair share of issues with ACF, but end up using it still. There could be 3 things causing your problem. you could try changing your php settings: max_input_time = 42000 ...
rudtek's user avatar
  • 6,143
1 vote

Comments waiting but no comments found

This might be a conflict/issue with your theme. What theme are you using? Have you checked any comment or translation related settings in your themes settings (if any)? You can also try this method ...
dylzee's user avatar
  • 135
1 vote

wpml and languages with different directions

Could not found why the is_rtl() is not working properly, but found that wpml_is_rtl is doing it's own job, so by adding this code to theme's functions.php everything seems to work fine: if ( ...
Muhammad Naderi's user avatar
1 vote

After disabling WPML multi currency, the currency is still handled by the WPML

First at all, I just use WPML one time and I really don't liked it. It comes to me, that you maybe leave some po/mo files in the wp-content/languages/woocommerce-multilingual/ or wpml one. I found on ...
Benoti's user avatar
  • 2,436
1 vote

Mysql SELECT posts

I resolved creating SQL query: SELECT posts.post_title, posts.post_content, trans.element_type, trans.language_code FROM wp_posts AS posts INNER JOIN wp_icl_translations AS trans ON posts.ID = trans....
Jose Carlos Ramos Carmenates's user avatar
1 vote

WPML translate without duplicating post

If you still need help the best way is to ask in WPML forum. (Client can make special account for you, so you can ask question in WPML forum) First check if all necessary plugins are installed: ...
anseme's user avatar
  • 11

Only top scored, non community-wiki answers of a minimum length are eligible