doujiaoben28596 2016-03-23 12:24
浏览 43
已采纳

使用木材get_posts时绕过Bogo路线

I am using Timber get_posts method and Bogo-localization add on in my WordPress based application. The application is localized to multiple languages using Bogo. The different version of the application is accessed via urls that contain the desired locale for example wwww.myapplication.com/en, wwww.myapplication.com/sp, wwww.myapplication.com/ge etc. There is also an unlocalized or default language version of application. I also have bunch of posts in the database with post type of 'product'. These posts do not contain any localizable data so there is no need to create localized versions of them. My question is can I access unlocalized versions these posts from the localized version in my application? For example the code below works fine when accessed from wwww.myapplication.com, but when I try access it for example from wwww.myapplication.com/ge the results variable is empty.

  $args = array(
    'post_type' => 'product',
    'orderby'   => 'date',
    'order'     => 'DESC',
    'posts_per_page' => '-1'
    );
 $resultss = Timber::get_posts($args);
  • 写回答

1条回答 默认 最新

  • dongliqian6245 2016-04-01 12:45
    关注

    The following query parameters did the trick.

    $args = array(
    'post_type' => 'product',
    'orderby'   => 'date',
    'order'     => 'DESC',
    'posts_per_page' => '-1',
    'suppress_filters' => true
    );
    $resultss = Timber::get_posts($args);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?