wordpresscustom-wordpress-pagesfacetwp

FacetWP - how to put custom order by


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


Solution

  • 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
      );