Home › Forums › General Issues › Sort posts in a widget using 2 ACFs › Reply To: Sort posts in a widget using 2 ACFs
Some issues with your current code.
ACF does not store date fields in the DB as dates. It saves strings that are in the format of ‘Ymd’, so using a type of “DATE” will produce errors.
If you want to sort by the second field then that field must have a value in the DB (even if that value is an empty string). WP will ignore any posts that do not have a value set for a field. I’m not sure what you mean by optional, but in this case the field would always need to be visible and allow no input.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.