-
anthvale
Having an issue with the code from this page: https://docs.generateblocks.com/article/order-query-loop-by-custom-field/
Here is what I have inside the Snippets Plugin:
//CHAR type custom field value add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) { // apply filter if loop has class: order-by-priority if (! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'order-by-ambassador-state' ) !== false) { $query_args = array_merge( $query_args, array( 'meta_key' => 'ambassador-state', 'orderby' => 'meta_value', 'order' => 'ASC', )); } return $query_args; }, 10, 2 );
I have order-by-ambassador-state as the class for the grid inside the query loop.
On the front end, the loop is broken and doesn’t display.
Thanks,
-
anthvale
Ok, I got it to work! Thank you
-
Alvind
Great to hear that!
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.