今天我在wordpress的头版有个问题。
我使用polylang,当我在页面上更改语言时,我的页面使用糟糕的语言(默认语言)。
例如:我的默认语言是波兰语,对于波兰用户,我显示文本:
康塔克特
当我用英语换语言时,我可以看到:
联系方式
但是现在我看到了糟糕的结果,我可以看到:
康塔克特
我用的模板是20,17,polylang。
谢谢您的所有答复。
发布于 2017-04-24 17:54:49
我做到了。我编辑了文件
template/inc/template-tags.php
现在我在文件中的*_front_page_section是这样的
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>';
}
}当我没有翻译时,我的代码会显示默认语言。
https://stackoverflow.com/questions/43564933
复制相似问题