user1937021
user1937021

Reputation: 10781

qtranslate showing all languages in wordpress loop

I'm using qtranslate but for some reason, in my loop it's show the posts in both languages I have them in English and Spanish, what could be wrong? So it's displaying each post twice for each language.

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
           ...

  <h2><?php $queried_post = get_post($post->ID); $title = $queried_post->post_title; echo apply_filters('the_title',$title ); ?> </h2>
  <p><?php $queried_post = get_post($post->ID); echo apply_filters('the_content',$queried_post->post_content); ?> </p>
                        ...

            <?php endwhile; ?>
        <?php else :// Show the default message to everyone else.?>

        <?php endif; // end have_posts() check ?>

Upvotes: 2

Views: 994

Answers (1)

thomas_inckx
thomas_inckx

Reputation: 470

I had the same problem and I solved it by using new WP_query instead of $queried_post:

    <?php
// WP_Query arguments
$args = array (
    'page_id'                => 'yourpageID',
);

// The Query
$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
        $query->the_post();
        // do something
        the_content();      
    }
} else {
    // no posts found
}

// Restore original Post Data
wp_reset_postdata();
?>

Hope this helps.

Greetz,

Thomas

Upvotes: 1

Related Questions