I am using a WordPress 3.8 installation with qtranslate, and everything is working except for the recent posts titles. Qtranslate displays the titles with all languages after each other. Like: English title German title French title

The code I am using to display a list with recent post titles is:

$recent_posts = wp_get_recent_posts();
foreach( $recent_posts as $recent ){
    echo '<li class="lastposts"><a href="' . get_permalink($recent["ID"]) . '" title="'.esc_attr($recent["post_title"]).'" >' .   $recent["post_title"].'</a> </li> ';

I have googled for this problem and it seems like Qtranslate does not work with post_title. How can I make it work?


Qtranslate works probably with a filter on the_title. So you have to use functions that make use of that filter, not the raw post title.

Example, not tested:

foreach( $recent_posts as $recent ) {
        '<li class="lastposts"><a href="%1$s" title="%2$s" >%3$s</a></li>',
        get_permalink( $recent["ID"] ),
            array (
                'post' => $recent["ID"],
                'echo' => FALSE
        get_the_title( $recent["ID"] )
  • Thank you very much! It tested it and it works perfectly. Really appreciate your help. thanks again, i have been messing with this for hours. :) – Tanks Jan 15 '14 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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