Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm new to this site but looking at the quality of answers provided here I will be here for a long time :)

Ok, first a bit of info:

I'm developing a bilingual website (English & Japanese) using Wordpress and the WPML Multi-lingual CMS. The site is for a cafe in Tokyo, Japan. All the products names and descriptions have been written in English and translated into Japanese. Doing so, using WPML, produces 2 identical products, 1 in English and 1 in Japanese. The slugs are named after the product name, so for example the product "Caramel Cappuccino" has the slug "caramel-cappuccino". And, the corresponding Japanese version has the slug "caramel-cappuccino-ja". This is the same for all products in both languages with all the Japanese version products getting -ja at the end.

Now comes my problem:

There is a template, that was included by the author of the theme, that produces a Menu like you would see in a restaurant. The problem is that the menu displays all of the products in both languages regardless of whether English or Japanese has been selected as the language of the site by the user. So, if you check the links below, you will see that all the products are displayed twice. You can see the current situation here:

English: http://www.oasis-radio.net/mobile/wordpress/menu/ Japanese: http://www.oasis-radio.net/mobile/wordpress/ja/menu-ja/

What I want to do:

I want to create some kind of loop, where if the the language selection is English, only the English versions of the products are displayed and likewise, if the language selection is Japanese, only the Japanese versions of the products are displayed. I've tried a few different things but can't seem to get anything to work.

This is the php code for the template that produces the Menu page:

    <?php
/**
 *
 * A custom page template without sidebar, full width.
 *
 * @package WordPress
 * @subpackage Ermark Adora
 *
 */

    get_header();

    echo '<div class="section clearfix">';
        if (get_option('ermad_products_menu_of_the_day', 'false')=='true') {
            echo '<div class="menuDescription">';       
        }

             if ( have_posts() ) while ( have_posts() ) : the_post(); 
                 if ( is_front_page() ) { 
                    echo '<h2 class="entry-title">'.get_the_title().'</h2>';
                 } else { 
                    echo '<h1 class="entry-title">'.get_the_title().'</h1>';
                 } 

                the_content();

                wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'adora' ), 'after' => '</div>' ) );

                edit_post_link( __( 'Edit', 'adora' ), '<span class="edit-link">', '</span>' );
            endwhile;


        if (get_option('ermad_products_menu_of_the_day', 'false')=='true') {
            echo '</div>';
            echo '<div class="menuDayOffer">';
                echo '<p>'.get_option('ermad_products_menu_description', 'Go to admin panel to edit this description, you must add text for two lines for shure.').'</p>';
                loadProductsInOffer();
            echo '</div>';
        }

    echo '</div>';

    ?>  
        <div class="section hr"></div>

        <div class="section clearfix">

            <div id="wrapper-prices-center" >
            <div id="wrapper-prices-bottom" >
            <div id="wrapper-prices-top" >

            <?php  loadProductsCateg(); ?>

            </div>          
            </div>          
            </div>          
        </div>          

        <div class="section hr"></div>

<?php 

get_footer(); ?>

Any help would be greatly appreciated!

Dan

share|improve this question
    
I'm not sure I follow as I see 2 different menus on the two pages you linked to, one in English and one in Japanese. –  Piet Jun 10 '11 at 10:49
    
@Piet. Yes, there are 2 different menus being produced. First, cufon is enabled for the English menu and cufon is disabled for the Japanese menu (as is true for the site in general). I'm checking into a few things now regarding this problem and I'll post again when I have better information for you. –  Dan Elliot Jun 13 '11 at 10:35

1 Answer 1

WPML has a feature called "Automatically Adjust IDs" which detect when specific items are loaded and adjust IDs so that the results are adjusted for the active language.

This functionality is enabled by default and can be accessed via WPML->Languages (visible in Advanced mode):

share|improve this answer
    
Hello again, First, thank you for responding to my question. @Piet. Yes, there are 2 different menus being produced. First, cufon is enabled for the English menu and cufon is disabled for the Japanese menu (as is true for the site in general). I'm checking into a few things now regarding this problem and I'll post again when I have better information for you. @Bainternet Automatically Adjust IDs is and has been enabled from the start. –  Dan Elliot Jun 13 '11 at 8:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.