Order Posts By ACF Value in WordPress and Oxygen

Order Posts By ACF Value in WordPress and Oxygen

Jonathan Jernigan

4 года назад

7,266 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@simonkerridge
@simonkerridge - 18.07.2020 19:11

Exactly the type of video tutorial I was looking for as a new Oxygen Builder user! Thank you! I am also just starting your courses.
Just a thought: would the order field have been better as a "Range" field type? By using actual numerical values it may sort better than using text fields to represent a numerical value.

Ответить
@renemaas7435
@renemaas7435 - 18.07.2020 19:12

You defined the field as text. If you order by value it will be ordered by text value. That’s the reason 7 is before 60. Use type number to get the correct order. The numbers you have to use are 60 for Ariana and 10 for Anna. Or set your order by descending / ascending.

Ответить
@chrisgreen5711
@chrisgreen5711 - 18.07.2020 19:15

Hi Jonathan, great tutorial again. I think the ordering issues you had when you changed the number of digits etc is probably because you are using a text field instead of a number field for order value. If you changed it to a number field, it would hopefully work properly. Cheers

Ответить
@andrewmcbride88
@andrewmcbride88 - 18.07.2020 20:28

Thanks so much for the video. I thought this was going to be directed at a current problem I have. Sadly it was not.

How would you sort by a custom field, like start date for events, for archives using the default query that would cover categories, tags etc

Ответить
@vovi547
@vovi547 - 19.07.2020 00:16

This is way over engineered. The plugin called post type order is much more user friendly than this approach. Clients love it.

Ответить
@hakamtdmouri9873
@hakamtdmouri9873 - 22.02.2021 19:37

I really want to thank you man 😊 you're solved my problem that I was days trying to solve it 👌 I really thank you. Keep going 😉

Ответить
@bikimel-directes
@bikimel-directes - 21.05.2021 16:07

Hello, thenk you, I wonder if the date orders well?

Ответить
@arvinsalvador2407
@arvinsalvador2407 - 06.07.2021 21:09

To resolve the issue of what value should be in the ordering, you can use basic numbering from 1 to N. The problem is in the query not repeater. To fix the issue use the following:

post_type=NAMEOFPOSTTYPE&meta_key=CUSTOMFIELDNAME&orderby=meta_value_num&order=ASC

You have used meta_value that treats numbers as normal characters and not a numeric value. Use meta_value_num to treat numbers as numbers and use order parameter to sort it either ASC = ASCENDING or DESC = DESCENDING.

I hope this helps :)

Ответить
@faizsheikh9442
@faizsheikh9442 - 29.07.2021 08:44

I have a CPT with taxonomy/archive template and have 100+ taxonomy, I use the 'Default' repeater query and the post shows from the respective categories only. But I want to use this custom field order, can you tell me what is the manual query for pulling the posts from current taxonomy(like how the default query works)?

Ответить
@AnandDavis
@AnandDavis - 17.05.2022 08:50

you need to use orderby=meta_value_num&order=ASC or DESC and you wont have a problem with single double or triple digits, it will order it by the numerical value.

Ответить