S
S
SAYri2021-09-22 12:38:33
WordPress
SAYri, 2021-09-22 12:38:33

How to sort posts in Wordpress but if nothing is found then posts are shown anyway?

There is such a form with various filters.
614af7b65d265642528683.png

As it works now, when we sort records and nothing was found for this field "Square Feet" (although there are records for other fields), wordpress does not return anything. Since the sorting goes on the field (Square Feet) which is not in the records.

Code responsible for sorting.
614afc7c28abf581881541.png

You need to make sure that the records are still displayed.
Has anyone come across such a situation?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sobolev, 2021-09-23
@san_jorich

If the request for filters is empty, display the standard
. In general, you can add Square Feet like an arbitrary field and display it according to it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question