• I’m using qTranslate plugin, default language is Turkish, and other language is English. For example, Turkish site is in http://example.com and English side is in http://en.example.com. Everything is ok with qTranslate, but in Related Post i have a weird problem.

    My Related Posts code is as you see;

    <!-- Related Posts-->
    <?php
    $backup = $post;
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
    $tag_ids = array();
    foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
    
    $args=array(
    'tag__in' => $tag_ids,
    'post__not_in' => array($post->ID),
    'showposts'=>4, // Number of related posts that will be shown.
    'caller_get_posts'=>1
    );
    
    $my_query = new wp_query($args);
    if( $my_query->have_posts() ) {
    //echo '<h2>Benzer Yazılar</h2><ul class="relatedPosts">';
    _e('[:tr]<h2>Benzer Yazılar</h2><ul class="relatedPosts">[:en]<h2>Related Posts</h2><ul class="relatedPosts">');
    while ($my_query->have_posts()) {
    
    $my_query->the_post();
    
    ?>
    <li><?php the_post_thumbnail(array(40,40)); ?><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    <?php
    }
    echo '</ul>';
    }
    }
    $post = $backup;
    wp_reset_query();
    ?>
    <!-- end Related Posts-->

    With this code, if you in English side, All related posts’ URL starts en.example.com/xyz, but some articles in Turkish language which must be start with example.com/xyz. In reverse, when you are in Turkish side, All related posts shows url in Turkish url format so http://example.com/xyz, but some related post’s url is english.

    How can i handle this problem.

  • The topic ‘qTranslate shows default url in related posts’ is closed to new replies.