Use more than 3 languages in template files
-
Hello,
I have one problem I’m making a multi language website for 7 languages, for each language there is a post created in the backend so that can be easily edited. In template files there is an IF function to display correct post when there is a language switch. I have managed to set it up to work for 3 languages, does anyone have an idea how to extend it to 7 languages?
Sample code:
<?php $currentlang = get_bloginfo('language'); if($currentlang=="sl-SI"):?> <?php $post_id = 93; $queried_post = get_post($post_id); $content = $queried_post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?> <?php elseif($currentlang=="en-GB"):?> <?php $post_id = 117; $queried_post = get_post($post_id); $content = $queried_post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?> <?php else: ?> <?php $post_id = 15; $queried_post = get_post($post_id); $content = $queried_post->post_content; $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); echo $content; ?> <?php endif; ?>
Best regards, Jurij
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Use more than 3 languages in template files’ is closed to new replies.