Support » Your WordPress » my multilingual setup

my multilingual setup

  • well, i’m just proud of my new multilingual setup, i been testing for two years so far, my goal was to make just simple website with same admin panel and ability to write in two languages, the problem is i do write in Arabic which is rtl, and that looks bad when mixed with English.
    my front page is in Arabic:
    fashionied, the fashion design site
    every thing should be in Arabic, but the English categories, EN single posts, and i need English front page as well.
    i made 5 Arabic categories and 3 English cats, the first step was to make category template for the EN ones so i just made them, put them in the theme folder, for the header, footer, sidebar, and CSS file, i made folder, and put all this file in it, called them from my EN cats template.
    so far so good.
    now i wanna exclude the English posts from the Arabic front-page which is the default index.php, simply i used this code:
    $cat1 = get_cat_ID(‘fashion design’);
    $cat2 = get_cat_ID(‘pattern making’);
    $cat3 = get_cat_ID(‘garment sewing’);
    $q = ‘cat=-‘.$cat1 .’, -‘ . $cat2 .’, -‘ . $cat3;
    query_posts($q .’&paged=’.$paged);?>

    now my front-page is 100% Arabic, i have the Arabic cats and posts running well too.
    now i wanna have EN template for the English single posts, so i add this code the the very start of single.php file:
    <?php if ( in_category( array( ‘garment sewing’, ‘fashion design’, ‘pattern making’ ) )) {
    include(TEMPLATEPATH . ‘/en/single.php’);
    } else {

    if it’s English post use the English single post template, other wise go on with default one. i had to end the IF statement by adding this line to the end of the sinle.php file. <?php } ?>
    now i want to make English front page, just made a page template with a loop started like this:
    $cat1 = get_cat_ID(‘fashion design’);
    $cat2 = get_cat_ID(‘pattern making’);
    $cat3 = get_cat_ID(‘garment sewing’);
    $q = ‘cat=’.$cat1 .’, ‘ . $cat2 .’, ‘ . $cat3;
    query_posts($q .’&paged=’.$paged);?>

    this lets the page to query posts from this 3 cats only, then i add the usual template code necessary to show posts.
    here it is:
    fashionied in EN
    of-course the header, footer, sidebar, and css for EN content is different than AR, the EN pages uses EN template different than Arabic ones.
    so now i’m happy with easy to manage single website, with two languages, every one of them is shown the right way, just cant stop myself from working further, i dont know where or why, i just like doing it :).
    i’m not coder, not web developer, i’m just fashion designer, who loves php, css and WordPress.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘my multilingual setup’ is closed to new replies.
Skip to toolbar