How to get posts in different language from WPML Plugin [closed]

Assuming $new_lang holds the desired two letter language code (e.g. ‘fr’), you can do this: global $sitepress; $current_lang = $sitepress->get_current_language(); //save current language $sitepress->switch_lang($new_lang); //…run query here; if you use WP_Query or get_posts make sure you set suppress_filters=0 … $sitepress->switch_lang($current_lang); //restore previous language For more info, check http://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/debugging-theme-compatibility/

Rewrite url for custom post type

this will not work: ‘en/index.php?post_type=vinos’ there is no en/index.php, it has to be: ‘index.php?post_type=vinos’ if you need to detect en in the path, add a query var, then set that query var in your rewrite: function wpa_query_vars( $qvars ) { $qvars[] = ‘wpa_lang’; return $qvars; } add_filter( ‘query_vars’, ‘wpa_query_vars’ ); then in your rewrite rule: … Read more

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 Rent taxonomies for the Property post type. Look into WP_Rewrite class, too, and you can get greater control over url permalink structure.

Best pratice to make taxonomy terms translatable without changing slugs?

I’m not really up to date on WPML and how it handles translations, but my general understanding is that in most cases it simply creates duplicate entries for each language and links them together with the “original”. However, I recently hade a similar problem where I needed the ability to add a “pluralized” version of … Read more

WPML: getting page title in different language

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 ); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)