Support » Plugins » POLYLANG and ElegantThemes

  • I am kinda new to wordpress and need some help to get going.
    First, great plugin, Polylang! Works almost perfect with ElegantThemes except on the homepage.

    On the homepage there are 3 columns for page, post and blog.
    But when I change the language, the blog, pages and posts remain in the primary language.

    IS there a simple way to fix this?

    Now, I am trying to change the code for the homepage of the template to show the correct language, but with partial success so far.

    This seams to work for the post widget.

    <!-- here starts the postwidget -->
    <?php query_posts("showposts=".get_option('deepfocus_fromblog_number')."&cat=".get_cat_ID(get_option('deepfocus_blog_cat')."&lang=".pll_current_language($value)));
    										if (have_posts()) : while (have_posts()) : the_post(); ?>
    <li class="clear fix">
    <a href="<?php the_permalink(); ?>" class="title"><span><?php truncate_title(30); ?></span></a>
    <span class="postinfo"><?php esc_html_e('Posted','DeepFocus'); ?> <?php esc_html_e('by','DeepFocus'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on','DeepFocus'); ?> <?php the_time(get_option('deepfocus_date_format')) ?></span>
    <?php endwhile; endif; wp_reset_query(); ?>

    I added ."&lang=".pll_current_language($value) in the first line.

    And this code seems to be responsible for displaying the pages or post.
    But I got no clue on ho to fix this.

    <?php if (get_option('deepfocus_blog_style') == 'false') { ?>
    					<?php for ($i=1; $i <= 2; $i++) { ?>
    						<?php query_posts('page_id=' . get_pageId(html_entity_decode(get_option('deepfocus_home_page_'.$i)))); while (have_posts()) : the_post(); ?>
    							<div class="service">
    								<h3 class="hometitle"><?php the_title(); ?></h3>
    								<?php global $more;
    								$more = 0;
    								the_content(''); ?>
    								<a href="<?php the_permalink(); ?>" class="readmore"><span><?php esc_html_e('Learn More','DeepFocus'); ?></span></a>
    							</div> <!-- end .service -->
    						<?php endwhile; wp_reset_query(); ?>
    					<?php } ?>

    Any idea how to change this or is there another way to get ElegantThemes to work with polylang? Template i am using it Deepfocus.

    Also I was wondering how to get the corresponding page-ID’s of the same pages/blogs/posts of the other languages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You can get the translated page id in the current language with

    $translated_page_id = pll_get_post($page_id);

    And for a cat, it works pretty much the same:

    $translated_cat_id = pll_get_term($cat_id);

    This should help you solving your issue

    Thnx, Chouby!
    You really respond quick!

    This helps a lot.
    Hard to understand what does what, but I managed to fix my problem… using the pll_get_post()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘POLYLANG and ElegantThemes’ is closed to new replies.