首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有polylang的wordpress首页部分

带有polylang的wordpress首页部分
EN

Stack Overflow用户
提问于 2017-04-22 21:40:35
回答 1查看 739关注 0票数 0

今天我在wordpress的头版有个问题。

我使用polylang,当我在页面上更改语言时,我的页面使用糟糕的语言(默认语言)。

例如:我的默认语言是波兰语,对于波兰用户,我显示文本:

康塔克特

当我用英语换语言时,我可以看到:

联系方式

但是现在我看到了糟糕的结果,我可以看到:

康塔克特

我用的模板是20,17,polylang。

谢谢您的所有答复。

EN

回答 1

Stack Overflow用户

发布于 2017-04-24 17:54:49

我做到了。我编辑了文件

template/inc/template-tags.php

现在我在文件中的*_front_page_section是这样的

代码语言:javascript
复制
function acousticquartet_front_page_section( $partial = null, $id = 0 ) {
    if ( is_a( $partial, 'WP_Customize_Partial' ) ) {
        // Find out the id and set it up during a selective refresh.
        global $acousticquartetcounter;
        $id = str_replace( 'panel_', '', $partial->id );
        $acousticquartetcounter = $id;
    }

    global $post; // Modify the global post object before setting up post data.
    if ( get_theme_mod( 'panel_' . $id ) ) {
        global $post;

        if(pll_get_post(get_theme_mod( 'panel_' . $id ))):
            $id = pll_get_post($id = get_theme_mod( 'panel_' . $id ));
        else:
            $id = get_theme_mod( 'panel_' . $id );
        endif;

        $post = get_post( $id );
        setup_postdata( $post );
        set_query_var( 'panel', $id );

        get_template_part( 'template-parts/page/content', 'front-page-panels' );

        wp_reset_postdata();
    } elseif ( is_customize_preview() ) {
        // The output placeholder anchor.
        echo '<article class="panel-placeholder panel acousticquartet-panel acousticquartet-panel' . $id . '" id="panel' . $id . '"><span class="acousticquartet-panel-title">' . sprintf( __( 'Front Page Section %1$s Placeholder', 'acousticquartet' ), $id ) . '</span></article>';
    }
}

当我没有翻译时,我的代码会显示默认语言。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43564933

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档