FacetWP - how to put custom order by

2019-08-20 17:10发布

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条回答
forever°为你锁心
2楼-- · 2019-08-20 17:24

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
  );
查看更多
登录 后发表回答