Hot answers tagged plugin-wpml
7
I would like to recommend WPML, I use it on all of my bi/multi-lingual projects. It has great support and it makes WordPress truly multilingual, instead of only your content.
The latest addition is the media module, which takes care of the images you upload to Posts and Pages. No need anymore to upload them for each language separately, the plugin now ...
4
_e() will translate the text passed as a argument to the language your site is currently set up to use (if the translation exists).
Anyway, don't do that. Use it for text visible on the website, not for IDs/classes etc. To create context based css rules, simply add the WPML language ID as a body class:
add_filter('body_class', 'wpml_body_class');
function ...
3
For the language filter from WPML to take effect you have to allow filters in get_posts. Default this is off.
You can add suppress_filters=0 to your get_posts args and it should work. See: http://codex.wordpress.org/Template_Tags/get_posts#Parameters
<ul id="archive-list">
<?php $args = array( 'suppress_filters' => false, 'numberposts' ...
3
First of all i wouldn't use phpmyadmin for a database that large. Use something like Sequel Pro its free and easy to use.
Second if you dont want the tables that WPML Created and you have removed the plugin from your site you can remove the tables that it creates.
Upload the sql to a new database on your local machine and remove all this tables for each ...
2
If you want to have variables in your text to be translated the usual way would be with string formatting like so:
<?php
printf(__("text %s text2."), $message);
?>
with integers:
<?php
printf(__("text %d text2."), $count);
?>
with more then one placeholders:
<?php
printf(__("text %1$s text2 %2$S."), $message, $message2);
?>
but ...
2
Thanks for that mike23, was a lifesaver for me today. However that exact code didn't work for me, I did have to do some modifications in order to get it to work in my situation which may be due to a newer version of the WPML plugin.
I had to change:
$original_ID = icl_object_id( $post->ID, 'post', false, 'en' );
to:
$original_ID = icl_object_id( ...
2
Let's say the original language of your site is english, then when visiting a german post you would return the title of the corresponding english post like that :
// Get the post ID of original post
$original_ID = icl_object_id( $post->ID, 'post', false, 'en' );
// Get original post title
$original_title = get_the_title( $original_ID );
Hope that ...
2
You can accomplish different sidebar content per language with either the plugin Widget Logic, or with the Dynamic Widgets plugin
Alternatively you can make different sidebar templates per language and use a conditional on the language:
if(ICL_LANGUAGE_CODE=='en'){
get_sidebar('en');
}
if(ICL_LANGUAGE_CODE=='fr'){
get_sidebar('fr');
}
2
WPML defines constants that you can use go get the current language:
ICL_LANGUAGE_CODE - current language code (eg: en,fr,sp).
ICL_LANGUAGE_NAME_EN - Name of the current language in English (eg: English, French. Spanish).
ICL_LANGUAGE_NAME - Name of current language, in the current language (eg: English, Français, Español).
2
I came up with a function that does the job for now :
/**
* Creates a translation of a post (to be used with WPML)
*
* @param int $post_id The ID of the post to be translated.
* @param string $post_type The post type of the post to be transaled (ie. 'post', 'page', 'custom type', etc.).
* @param string $lang The language of the translated post (ie ...
2
I've done it with this bit of code:
global $wpdb;
$posts = get_posts(array('post_type'=>'...', 'posts_per_page'=>-1));
foreach($posts as $post) {
$wpdb->update('wp_icl_translations', array('language_code'=>'es'), array('element_id'=> $post->ID));
}
2
1. Don't use query_posts for secondary loops
This is just a general best practices recommendation and not the cause of your problem.
2. When you register the post type make sure 'public' => true,
3. Put the following in a template somewhere and report back the output. It will return the object of each registered custom post type and will verify ...
1
I've found what was going on, so I'm going to answer it for future reference, as it's a common issue without clear solution.
TL;DR: If the WPML language which's not redirecting has a country code (eg. en-US instead of en) then you probably have the same bug. Jump to section "How to fix it".
The Problem
The problem arises at the redirection ...
1
A .mo file is the machine readable Version of a .po file, which in turn holds the translation of a .pot file.
Hence, the latter is what you want to have in the first place.
And if it is your theme you want to localize, you certainly do not need a random plugin's simplified Chinese .mo file...
Using either, poedit, any other gettext application or the ...
1
Although @brasofilo already has given the correct answer, I would like to point out that WPML offers another way to displaying a link (to content within your website).
Say that you would like a link in the footer going to the About (with an ID of 3) page, you could code that as follows:
Using icl_link_to_element(ID, type, text, arguments, anchor):
...
1
You need to put your strings in translatable format.
<a href="URL"><?php _e( 'Link', 'your-theme-text-domain'); ?></a>
Function reference: _e(), this one echoes the value, for assignment, use $my_string = __( 'String', 'text-domain' );.
Also, check the following documentation: WordPress_in_Your_Language#Introduction and WPML - Getting ...
1
You should always use the wpml functions as following: (the HowTo linked by you actually suggests this :-)
if( function_exists('icl_register_string') ) { icl_register_string( 'Match Previous Order' , 'match_order', 'Do you want these items to match a previous order from Direct Linen? If yes, use "Additional Notes" to explain.' ); }
This will ensure that ...
1
No matter what languages your site are in, when using WPML you should never install a localised WordPress version, instead you should just install the default one (i.e. US English).
Also make sure that you didn't change the LANG definition in your wp-config.php file, so that should read: define ('WPLANG', '');
Then you need to make sure that all the ...
1
Interesting questions, I'll try my best, but I hope others can also give input.
re 1. Usually I use the theme's text domain also for strings that are likely to be present in the main WordPress translation file
re 2. correct
re 3. I think it is a good idea, but I don't know if it is bad practice or anything like that
re 4. correct
re 5. I also think it ...
1
I had this problem with querying on two custom post types, using WP_Query. I had no problem querying for one type or the other in the array, but not both at the same time.
Did not work:
$args = array(
'post_type' => array('custom_type_1','custom_type_2'),
'posts_per_page' => 4
);
Did work:
$args = array(
'post_type' => ...
1
Wow. not sure of exactly what the culprit is (will dig further) but it seems that something about WPML was preventing the actual SQL query from requesting the custom post type in conjuction with standard posts and pages. When I disabled WPML it worked. Thanks for all the help everyone - I'm going to follow up on this issue once I have a more concrete idea of ...
1
Apologies, I find this a little bit a non-issue as it states clearly everywhere that WPML works 100% when you use a permalinks structure of day and name (http://domain.com/2012/02/07/sample-post/).
If this is something you cannot accept, then you's better come to terms with the fact that WPML most likely is not going to work 100% for you.
Or, to answer ...
1
To translate custom page templates you must select "Synchronize page template" in WPML options. For it to actually work the page template markup must be localized or internationalized using a recognized format, for example http://codex.wordpress.org/I18n_for_WordPress_Developers, and then have an accompanying .mo/.po file . WPML also has an addon called ...
1
add
if ( isset($_GET['debug']) && $_GET['debug'] == 'debug') define('WP_DEBUG', true);
to your wp-config.php file. then visit your site
http://www.cleanupisrael.org.il?debug=debug
you should get an error message instead of just a blank screen.
if that fails, then disable all the plugins and re-enable them one by one. not fun, but should tell ...
1
Why do you dont use the default functions from WP.
As example the follow class, there you can use.
class fb_pagination_example {
public function content_nav( $nav_id, $pag_bar = TRUE ) {
if ( $GLOBALS['wp_query'] -> max_num_pages > 1 ) : ?>
<nav id="<?php echo $nav_id; ?>">
<h1 ...
1
I think the reason that it is showing content in all languages, is because the language code arg should not be in the array.
I usually don't use surpress filters either.
If you have WPML properly set up, then you can go ahead and just use a custom query sth like:
<h2><?php _e('Archive','textdomain'); ?></h2>
<ul ...
1
I don't know how WPML impacts the handling of the rewrite rules, but it should be possible to create a rewrite rule that constructs the pagename from two different parts of the rewrite pattern. From the top of my head:
add_rewrite_rule('(..)/(.+)', 'index.php?pagename=$matches[2]-$matches[1]');
If you are going to do avanced stuff with rewrite rules you ...
1
When you develop a site on wordpress you may want to create posts/pages with the same name, something that wordpress does not allow by default.
This is statement is not true. WordPress will allow you to set up pages with the "directory" structure that you specified right out of the box. I was just able to do this on my test installation. I created a ...
1
The latest version of WPML (version 2.3) has a new module for Media and this module takes care of the previous images issue.
Now there is no longer the need to upload the same image twice.
Just like copying the content from the original language, it is now also possible to duplicate the images and/or the featured image:
1
I've discovered that the problem is an incompatibility between the WPML plugin and the Yoast WordPress SEO plugin. Specifically, enabling the "Redirect ugly URL's to clean permalinks" setting in the SEO plugin causes the redirect loop. I've contacted the plugin authors to inform them of the incompatibility and will try to help in getting the issue addressed ...
Only top voted, non community-wiki answers of a minimum length are eligible
