dev.xiligroup est en travaux › Forums › xili-language plugin › Filter language in query_posts?
Taggé: Cheap WOW Gold, filter, knowledge, loop, query_posts, query_tag, wp_query, xili_postinpost
Ce sujet contient 0 réponses et 6 voix, et a été mis à jour par xiligroup dev il y a Il y a 12 ans, 3 mois.
-
AuteurArticles
-
9 May 2011 at 13:49 #2910
AnonymeHello 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
10 May 2011 at 17:38 #2915
AnonymeHello, 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.
10 May 2011 at 20:33 #2916
AnonymeIs it the only loop inside the displayed webpage ? Can you show the array of the query ?
10 May 2011 at 21:04 #2918
Anonymehere 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.
10 May 2011 at 21:13 #2919
AnonymeOk sorry i’m dumb, i was using get_posts() instead of query_posts()
10 July 2012 at 22:24 #3126
AnonymeI 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;?>
11 July 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….
24 July 2012 at 19:53 #3131
AnonymeI 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
22 August 2012 at 15:10 #3152visiting your site seems that you find yourself the solution – please share your experience !
-
AuteurArticles
Vous devez être connecté pour répondre à ce sujet.