dev.xiligroup is being renovated › Forums › xili-language plugin › Filter language in query_posts?
Tagged: Cheap WOW Gold, filter, knowledge, loop, query_posts, query_tag, wp_query, xili_postinpost
This topic contains 0 replies, has 6 voices, and was last updated by xiligroup dev 12 years, 1 month ago.
-
AuthorPosts
-
May 9, 2011 at 13:49 #2910
AnonymousHello 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
May 10, 2011 at 17:38 #2915
AnonymousHello, 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.
May 10, 2011 at 20:33 #2916
AnonymousIs it the only loop inside the displayed webpage ? Can you show the array of the query ?
May 10, 2011 at 21:04 #2918
Anonymoushere 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>
<?php
$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>
<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>
</div>
<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>
</ul>
<?php endforeach; ?>
</div>
</div>
</div>
<?php get_footer(); ?>Every text displayed with _e is translated in the correct language.
May 10, 2011 at 21:13 #2919
AnonymousOk sorry i’m dumb, i was using get_posts() instead of query_posts()
July 10, 2012 at 22:24 #3126
AnonymousI tried this but had not luck, any ideas on fixing it. Using the latest WP3.4.1 and latest XILI-Language:
<?php
$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):
setup_postdata($post);?>
<?php the_field(‘story’); ?>
<hr>
<?php endforeach;?>
July 11, 2012 at 6:21 #3127As Lozit said, you must use query_posts() function or use new wp_query – see full doc http://codex.wordpress.org/Function_Reference/WP_Query
You can also use xili_postinpost plugin that provides a secure way….
July 24, 2012 at 19:53 #3131
AnonymousI 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
the_curlang()
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
August 22, 2012 at 15:10 #3152visiting your site seems that you find yourself the solution – please share your experience !
-
AuthorPosts
You must be logged in to reply to this topic.