How to order relationships in Bricks Builder query loops
Support › MB Relationships › How to order relationships in Bricks Builder query loops
- This topic has 5 replies, 2 voices, and was last updated 1 year, 6 months ago by
Peter.
-
AuthorPosts
-
April 13, 2024 at 11:41 PM #45212
Keith Cross
ParticipantWhen using a relationship in Bricks Builder, I don't see where I'm able to control the order (or number, etc.) of the posts. I've created a field for post order, but that doesn't take affect on the front end. I entered a query arg on the field for orderby, but that only seems to handle the display in the editor for those relationships. Any suggestions would be much appreciated. Thank you!
April 14, 2024 at 9:32 PM #45216Peter
ModeratorHello Keith,
The order of related posts in the frontend should reflect the order of related items in the admin area. Does it work like that on your end? Please try to use the code without the Bricks builder and let me know how it goes.
https://docs.metabox.io/extensions/mb-relationships/#getting-connected-itemsMay 17, 2024 at 8:43 PM #45456Keith Cross
ParticipantHi Peter,
Forgive the long pause in response to this. Are you saying that there is no way to order the related items by, say, date? I've created a relationship like this:Artists > Exhibitions (order Exhibitions by date)
Exhibitions > Artists (order Artist A-Z)Before I do more testing...just making sure I'm on the same page about what is possible.
KC
May 19, 2024 at 3:04 PM #45467Peter
ModeratorHello,
Yes, the order of related items in the frontend should reflect the order of related items in the admin area. You can use the parameter "order, orderby" of WP Query to override the default order of related items.
https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parametersMay 20, 2024 at 2:53 AM #45476Keith Cross
ParticipantPeter,
In some cases I'm able to order the items, but in this video you can see that it doesn't work smoothly.https://jam.dev/c/f87be178-ee97-46e3-bffc-c8d3ce12c69e
Additionally, that would be an onerous task were there to be many items.
I've tried using a meta key in Bricks for a date field in the query loop to get the orderby to work, but that hasn't worked either.
May 20, 2024 at 10:19 PM #45477Peter
ModeratorHello,
I've tried using a meta key in Bricks for a date field in the query loop to get the orderby to work, but that hasn't worked either.As I mentioned in the first reply: Please try to use the code without the Bricks builder and let me know how it goes. Following the documentation https://docs.metabox.io/extensions/mb-relationships/#getting-connected-items
In some cases I'm able to order the items, but in this video you can see that it doesn't work smoothly.You can try to deactivate all plugins except Meta Box, MB extension plugins, switch to a standard theme of WordPress and check the issue again.
-
AuthorPosts
- You must be logged in to reply to this topic.