I was wondering how to translate content under index.php
(or category.php
with qtranslate?).
I’m using twenty twelve theme.
My code on index.php
:
<?php
/**
* The main template file.
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
?>
<?php get_header(); ?>
<?php
$page_id = 1500;
$page_data = get_page( $page_id );
echo apply_filters('the_content', $page_data->post_content);
?>
<section id="last-articles_homepage">
<h1>Latest News</h1>
...
I would like to translate the content inside the <section>
and <h1>
tag for example in french.
Most correct way to do this would be to use WordPress translations.
You should replace this static text with:
And add text domain to your theme.
More on this topic: http://codex.wordpress.org/I18n_for_WordPress_Developers
You can also…
… use
qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage
function.Just use it like so:
This solution worked for me
Note : the ” : ” is before the language, not after
I found the solution for a related problem of mine in a Qtranslate Support forums:
I hope it would work for you! 🙂
I got this from WP Forums and it worked for me.