4
votes
2answers
176 views

Order by optional meta key?

I'm building the sorting functionality for a custom post type, and I have a custom meta value for "Featured" posts. This value is set when you tick the checkbox, otherwise it is not set. Using the ...
0
votes
1answer
33 views

How can I use 'orderby' => 'meta_value_num' to order by the numerical value even if the value starts with a word?

I'm using 'orderby' => 'meta_value_num' to order some boats I have as a custom post type, the meta values ordered by, are boat models, which are normally just numbers but if you look at this page: ...
0
votes
1answer
70 views

Compare 3 custom fields and sort by oldest

I am building a movie archive. For each movie I am filling out the release dates for 3 countries, they're stored as custom fields (added via Pods) Now, when listing the movies I would like to build ...
0
votes
0answers
235 views

Sort users by custom user meta value

I'm trying to sort users by a custom meta value "user_business" which is their business name that way when users are listed they're sorted alphabetically by their business name as they should be. I'm ...
0
votes
1answer
148 views

How can I sort posts by the date and a custom meta field?

I have custom meta field that I use for the post rating. So I want to display posts by the date and the rating, but only for the posts that have specific rating. For example, I want to display posts ...
0
votes
2answers
681 views

Sort custom posts in archive by multiple values: date AND meta key

I have a post type and I want to sort posts in its archive according to two values: by a meta value called "artwork_year" which contains a 4 digit number (year) by post publish date what the query ...
0
votes
1answer
1k views

order posts by meta value on posts page

I've been reading alot about how to order posts by a meta_value, but I can't seem to get it to work for me. My meta_key is called date, and it is stored as yyyy-mm-dd. Here's where I've gotten to so ...
0
votes
1answer
726 views

mySQL query. ORDER BY meta_key

I'm fighting this quite long already and start to think I'm missing something big. CPT posts could have or not metadata ( _vip_post [0|1], _thumbnail_id [null|numeric] ). If i query for ...