Skip to main content
Notice removed Draw attention by CommunityBot
Bounty Ended with Daniel Sachs's answer chosen by CommunityBot
Tweeted twitter.com/#!/StackWordPress/status/248391330244464640
added 117 characters in body
Source Link
Will
  • 85
  • 1
  • 7

So here's my code, using the qTranslate plugin:

    query_posts(array('post_type' => 'uk_blog', 'numberposts' => 2));
    $i = 0; while(have_posts()): the_post($post);?>
    <div class="third-column"<?php if ($i == 1) echo ' style="margin-right:0;"';?>>
        <h2><a href="<?php get_permalink($post->ID);?>"><?php the_title();?></a></h2>
        <div class="inner">
            <?php $length = strlen(get_the_content());
            echo nl2br(substr(strip_tags(get_the_content()), 0, 500));
            if ($length > 500){
                echo '...<br /><a href="' . get_permalink($post->ID) . '">Read more</a>';
            }
            ?>
        </div>
    </div>
    <?php $i++; endwhile;?>

The post titles (using the_title();) are actually appearing in all languages at the same time, ie: English titleFrench titleSpanish title.

Viewing the HTML source shows that the qTranslate tags that define which bit of a string is for which language are being directly outputted. IE the HTML source is

<!--:en-->English title<!--:--><!--:fr-->French title<!--:-->

The posts are from a custom post type.

Any ideas why this might be?

Thanks for reading!

So here's my code, using the qTranslate plugin:

    $i = 0; while(have_posts()): the_post($post);?>
    <div class="third-column"<?php if ($i == 1) echo ' style="margin-right:0;"';?>>
        <h2><a href="<?php get_permalink($post->ID);?>"><?php the_title();?></a></h2>
        <div class="inner">
            <?php $length = strlen(get_the_content());
            echo nl2br(substr(strip_tags(get_the_content()), 0, 500));
            if ($length > 500){
                echo '...<br /><a href="' . get_permalink($post->ID) . '">Read more</a>';
            }
            ?>
        </div>
    </div>
    <?php $i++; endwhile;?>

The post titles (using the_title();) are actually appearing in all languages at the same time, ie: English titleFrench titleSpanish title.

Viewing the HTML source shows that the qTranslate tags that define which bit of a string is for which language are being directly outputted. IE the HTML source is

<!--:en-->English title<!--:--><!--:fr-->French title<!--:-->

Any ideas why this might be?

Thanks for reading!

So here's my code, using the qTranslate plugin:

    query_posts(array('post_type' => 'uk_blog', 'numberposts' => 2));
    $i = 0; while(have_posts()): the_post($post);?>
    <div class="third-column"<?php if ($i == 1) echo ' style="margin-right:0;"';?>>
        <h2><a href="<?php get_permalink($post->ID);?>"><?php the_title();?></a></h2>
        <div class="inner">
            <?php $length = strlen(get_the_content());
            echo nl2br(substr(strip_tags(get_the_content()), 0, 500));
            if ($length > 500){
                echo '...<br /><a href="' . get_permalink($post->ID) . '">Read more</a>';
            }
            ?>
        </div>
    </div>
    <?php $i++; endwhile;?>

The post titles (using the_title();) are actually appearing in all languages at the same time, ie: English titleFrench titleSpanish title.

Viewing the HTML source shows that the qTranslate tags that define which bit of a string is for which language are being directly outputted. IE the HTML source is

<!--:en-->English title<!--:--><!--:fr-->French title<!--:-->

The posts are from a custom post type.

Any ideas why this might be?

Thanks for reading!

Notice added Draw attention by Will
Bounty Started worth 100 reputation by Will
Source Link
Will
  • 85
  • 1
  • 7

Titles in my sidebar widget appear in all languages - with qtranslate

So here's my code, using the qTranslate plugin:

    $i = 0; while(have_posts()): the_post($post);?>
    <div class="third-column"<?php if ($i == 1) echo ' style="margin-right:0;"';?>>
        <h2><a href="<?php get_permalink($post->ID);?>"><?php the_title();?></a></h2>
        <div class="inner">
            <?php $length = strlen(get_the_content());
            echo nl2br(substr(strip_tags(get_the_content()), 0, 500));
            if ($length > 500){
                echo '...<br /><a href="' . get_permalink($post->ID) . '">Read more</a>';
            }
            ?>
        </div>
    </div>
    <?php $i++; endwhile;?>

The post titles (using the_title();) are actually appearing in all languages at the same time, ie: English titleFrench titleSpanish title.

Viewing the HTML source shows that the qTranslate tags that define which bit of a string is for which language are being directly outputted. IE the HTML source is

<!--:en-->English title<!--:--><!--:fr-->French title<!--:-->

Any ideas why this might be?

Thanks for reading!