FacetWP - how to put custom order by

半城伤御伤魂 提交于 2019-12-24 18:28:04

问题


I create custom fields using Pods Admin and FacetWP do show and filter on page.

but I need to change "order by" to custom field called "volta-rapida-tempo".

Like this:

<?php
    return array(
      "post_type" => "volta_rapida",
      "post_status" => "publish",
      "orderby" => "volta-rapida-tempo",
      "order" => "ASC",
      "posts_per_page" => 10
    );

How can I do this correctly?

Thanks


回答1:


You need to make 2 changes first change orderby with meta_value and add meta_key Please check below code for the same.

 <?php
    return array(
    "post_type" => "volta_rapida",
    "post_status" => "publish",
    "meta_key" => "volta-rapida-tempo",
    "orderby"           => "meta_value",
    "order" => "ASC",
    "posts_per_page" => 10
  );


来源:https://stackoverflow.com/questions/50499489/facetwp-how-to-put-custom-order-by

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!