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);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀