如何在插件 Polylang 中显示所有语言的帖子?
How to display posts in all languages in the plugin Polylang?
我正在使用 Polylang 插件并注意到我无法在所有语言中同时显示 post。这就是为什么我想知道
有没有办法在特定位置显示网站上所有语言的 posts
好吧,或者创建一种单独的语言,其中将显示来自网站所有语言的 posts
我必须这样做,以便它与其他版本分开工作 -is -en
他们会照常工作
但在页面上的某处[多语言新闻]或版本 -full
在不同版本的站点上创建的所有 post 都会显示
你需要这样的东西:
$args = array(
'post_type' => 'post',
'lang' => '', // no language specified
);
$posts = get_posts( $args );
if ( $posts ) {
foreach ( $posts as $post ) :
//do whatever
endforeach;
wp_reset_postdata();
}
这将为您提供所有语言的所有帖子,如果需要,您可以向数组添加更多参数...
我正在使用 Polylang 插件并注意到我无法在所有语言中同时显示 post。这就是为什么我想知道 有没有办法在特定位置显示网站上所有语言的 posts 好吧,或者创建一种单独的语言,其中将显示来自网站所有语言的 posts
我必须这样做,以便它与其他版本分开工作 -is -en 他们会照常工作
但在页面上的某处[多语言新闻]或版本 -full 在不同版本的站点上创建的所有 post 都会显示
你需要这样的东西:
$args = array(
'post_type' => 'post',
'lang' => '', // no language specified
);
$posts = get_posts( $args );
if ( $posts ) {
foreach ( $posts as $post ) :
//do whatever
endforeach;
wp_reset_postdata();
}
这将为您提供所有语言的所有帖子,如果需要,您可以向数组添加更多参数...