This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Pierre 3 years, 6 months ago.

Assigned support staff: Pierre.

Author Posts
April 22, 2015 at 1:29 pm #604082

romainG-4

Hello,

I am trying to:

translate custom post type on my homepage template.
with this custom loop :

<div id="slider">      
   <div id="diaporama">
   <?php wp_reset_postdata(); ?>
   <?php query_posts('posts_per_page=-1&post_type=diaporama'); ?>
   <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
     <?php $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "size" ); ?>
     <li class="slide-home" style="background-image: url('<?php echo $thumbnail_src[0]; ?>')">
      <div class="container slide-info">
       <p class="slide-text">
        <?php echo get_the_content(); ?>
       </p>
      </div>
     </li>
    <?php endwhile; ?>
   <?php endif; ?>
   <?php wp_reset_postdata(); ?>
   </div>
  </div>

But the same language is visible in French and in English.

I'm sorry but the site i'm currently working on is in local so if it's necessary i'll create a pre-production space with the website.

Waiting for your response,

Best regards,

April 23, 2015 at 1:36 pm #604866

Pierre
Supporter

Languages: English (English ) French (Français ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello,

Thank you for your message!

Can you make sure you set your custom post type to "Translate" in WPML > Translation options (Custom post types section)?

Then, when you call a query to retrieve your posts types, you should add a "suppress_filters=0" parameters in the arguments, like this:

<?php query_posts('posts_per_page=-1&post_type=diaporama&suppress_filters=0'); ?>

Please have a look at our documentation: https://wpml.org/documentation/support/achieving-wpml-compatibility-for-your-themes-and-plugins/debugging-theme-compatibility/

Let me know if this helps.

Regards,
Pierre

The topic ‘[Closed] Custom post type translation problem in custom loop’ is closed to new replies.