【问题标题】:Order by title without taking into account 'the' in Wordpress (wp_query)按标题排序,不考虑 Wordpress 中的“the”(wp_query)
【发布时间】:2012-02-08 23:19:06
【问题描述】:

我目前有一个电视节目的剧集,其中有乐队演奏,例如,我有:

  • 白鲸
  • 花花公子沃霍尔
  • 怪人

我的 wp_query 如下所示:

$loop = new WP_Query(array('post_type' => 'episodio', 'cat' => '9', 'posts_per_page' => 90, 'orderby' => 'title','order' => 'ASC'  ));

但我想像这样按字母顺序排列它们,而不考虑“the”:

  • 花花公子沃霍尔
  • 怪人
  • 白鲸

数据库中有很多记录,因此将所有内容放入数组中,删除'the',再次排序然后遍历数组以显示数据,这不是很实用和/或有效。

这在 WP 中可能吗?也许通过过滤器?

提前非常感谢! :)

【问题讨论】:

  • 在表上创建另一列,清除 Thes 并根据该列的顺序返回
  • 这就是我最终要做的,非常感谢! :)

标签: sql-order-by wordpress


【解决方案1】:
$loop = new WP_Query(array('post_type' => 'episodio', 'cat' => '9', 'posts_per_page' => 90, 'orderby' => 'title','order' => 'DESC'  ));
you will get result post title descending of category 9.

【讨论】:

    猜你喜欢
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 2012-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-12
    相关资源
    最近更新 更多