Sort by Meta Value?
-
Hi – looking at ways to display posts from one site to another on a multisite. But, these posts need to be sorted alpha by a meta value – not seeing that option in your plugin? Is that true, or am I missing something?
Thanks in advance – otherwise, your plugin would be perfect for what I need!
-
Hi @swcomm ;
Are you talking about a numerical meta value like one placed in a custom field?
If so I don’t have anything like that directly but you could use acf to create a custom field called date and use that as your meta value. So each post can be given a later date so it will order by that.
So you would create a custom field called date picker and for each post choose a date and it will list by that order in ascending or descending fashion.
Here would be the shortcode attribute:
order_post_by_acf_date='acf_field_name asc'or
order_post_by_acf_date='acf_field_name desc'.If these don’t work let me know and I’ll see if I could implement an attribute as such.
order_post_by_custom_field='name_of_custom_field'.I’m assuming these custom numerical values are being dynamically created.
Are these meta values going to be a number? If so it can only be possible if it’s simple text (numeric or alphabetic) and not a complex string.
An example of what kind of meta value would be helpful.
We have order by title with the following argument:
order_post_by='date_order', order_post_by='alphabetical_order', order_post_by='page_order'.Other than that if I understood you correctly did you want to order meta value alphabetically or numerically?
Please let me know. Thank You.
-
This reply was modified 4 years, 4 months ago by
johnzenausa. Reason: Questioning about what type of meta_value
-
This reply was modified 4 years, 4 months ago by
johnzenausa.
Thanks for the reply. They are ACF fields, but not numeric or date fields. They’re text fields, to enable sorting posts alphabetically by a last name ACF custom field.
Okay wait for the next update please.
Thanks so much!
Please try the latest update and see if it works as you would like.
The argument to add to the shortcode is the following:
order_by_acf='field_name asc'ororder_by_acf='field_name desc'Hi – thank you. I’ve switched gears to another project so it may be a day or two before I get back to this. I’ll be back in touch ASAP.
Okay it’s there if need be.
Hi – finally finished this project and the meta sort works perfectly. Thanks so much!
Okay thank you.
-
This reply was modified 4 years, 4 months ago by
The topic ‘Sort by Meta Value?’ is closed to new replies.