I'm trying to make some changes to the blog template in order to get Polylang showing all my posts in Spanish in other languages. To do so, I need to know which php code gets the posts. Basically, what I was doing in my older website was replacing The Loop in index.php
with this:
<?php // force querying the Spanish posts global $wp_query; query_posts(array_merge($wp_query->query, array('lang' => 'es'))); ?> <?php if(have_posts()): the_post(); ?> <?php // get translated post (in current language) if exists global $post; if($post_id = pll_get_post($post->ID, pll_current_language())) { $post = get_post($post_id); setup_postdata($post); }?>
Hi,
I'm trying to make some changes to the blog template in order to get Polylang showing all my posts in Spanish in other languages. To do so, I need to know which php code gets the posts. Basically, what I was doing in my older website was replacing The Loop in index.php
with this:
<?php // force querying the Spanish posts
global $wp_query;
query_posts(array_merge($wp_query->query, array('lang' => 'es'))); ?>
<?php if(have_posts()): the_post(); ?>
<?php // get translated post (in current language) if exists
global $post;
if($post_id = pll_get_post($post->ID, pll_current_language())) {
$post = get_post($post_id);
setup_postdata($post);
}?>
Where should I make changes to the code?
Thank you in advance.
Hi, sorry, not quite sure what do you mean. Can you pls provide more details with screenshots what you need to do?
Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list.
Regards, Oliver