Adds order option to related items query in the theme helper function.
This commit is contained in:
parent
307d9d48f5
commit
a00e8fb11e
|
@ -1054,6 +1054,7 @@ class Theme_Helper {
|
|||
* Optional. Array of arguments.
|
||||
* @type string $item_id The Item ID
|
||||
* @type string $items_list_layout The type of list to be rendered. Accepts 'grid', 'list', 'mosaic' and 'carousel'.
|
||||
* @type string $order Sorting direction to the related items query. Either 'desc' or 'asc'.
|
||||
* @type string $class_name Extra class to add to the wrapper, besides the default wp-block-tainacan-carousel-related-items
|
||||
* @type string $collection_heading_class_name Extra class to add to the collection name wrapper. Defaults to ''
|
||||
* @type string $collection_heading_tag Tag to be used as wrapper of the collection name. Defaults to h2
|
||||
|
@ -1081,7 +1082,11 @@ class Theme_Helper {
|
|||
return;
|
||||
|
||||
// Then fetches related ones
|
||||
$related_items = $item->get_related_items();
|
||||
$related_items_query_args = [];
|
||||
if ( isset($args['order']) )
|
||||
$related_items_query_args['order'] = $args['order'];
|
||||
|
||||
$related_items = $item->get_related_items($related_items_query_args);
|
||||
if (!count($related_items))
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue