Filter language in query_posts?

dev.xiligroup is being renovated Forums xili-language plugin Filter language in query_posts?

This topic contains 0 replies, has 6 voices, and was last updated by  xiligroup dev 11 years, 9 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #2910


    Hello Floren,

    xili-language taxonomy since the very first time of his creation preserves the core architecture and add a query_tag named ‘lang’. So for a special query post, it is easy like below :

    $args = array(
    'cat' => 480,
    'year' => '2009',
    'monthnum' => '05',
    'order' => 'ASC',
    'lang' => 'en_us'
    query_posts( $args );

    where only posts of a category at good month (may) in english will be displayed…

    Good luck



    Hello, the solution looks easy… but doesn’t works for me.

    I would like to display only post of the selected language.

    The whole page is correctly translated but it always display post of any language.



    Is it the only loop inside the displayed webpage ? Can you show the array of the query ?



    here is the simplified code of my page :

    <?php get_header(); ?>
    <div class="SC">
    <div class="co3">
    <div class="actu-droite">
    <h3><?php _e('ACTU','DBG');?></h3>
    $args = array('lang' => 'en_us' );
    $myposts = get_posts( $args );
    foreach($myposts as $post) : setup_postdata($post);
    <div class="actu">
    <div class="p-head">
    <h3><a href="<?php the_permalink(); ?>"><?php the_title()?></a></h3>
    <div class="p-con">
    <p class="p-date-cat"><?php the_time('j-m-y') ?> | <?php _e('In:','DBG');?> <?php the_category(', ') ?></p>
    <p><?php echo truncate($post->post_content,256); ?></p>
    <ul class="p-det">
    <li class="p-det-com"><?php comments_popup_link(__('No Comments','DBG'), __('(1) Comment','DBG'), __('(%) Comments','DBG')); ?></li>
    <li class="p-det-more"><a href="<?php the_permalink()?>"><?php _e('More...','DBG');?></a></li>
    <?php endforeach; ?>
    <?php get_footer(); ?>

    Every text displayed with _e is translated in the correct language.



    Ok sorry i’m dumb, i was using get_posts() instead of query_posts()



    I tried this but had not luck, any ideas on fixing it. Using the latest WP3.4.1 and latest XILI-Language:


    $args = array(

    ‘cat’ => 12,

    ‘numberposts’ => 20,

    ‘orderby’ => ‘date’,

    ‘order’ => ‘DESC’,

    ‘post_type’ => ‘post’,

    ‘post_status’ => ‘publish’,

    ‘lang’ => the_curlang()


    $postslist = get_posts( $args );

    foreach($postslist as $post):


    <?php the_field(‘story’); ?>


    <?php endforeach;?>


    xiligroup dev

    As Lozit said, you must use query_posts() function or use new wp_query – see full doc

    You can also use xili_postinpost plugin that provides a secure way….



    I created multi site in wordpress using xili language plugin. Site has blog too. Site main language is Italian, when I click on Blog menu it landed to Spanish site. Please check following url

    I check current language by following function, it shows es_es


    I want If I click Blog menu on Italian site then Blog menu must be Italian, If I am on English site and click on Blog menu then menu must be English same as Spanish site.

    Hope you understand. I need its solution urgently. Please reply me soon


    xiligroup dev

    visiting your site seems that you find yourself the solution – please share your experience !

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.