Here is a little code snippet that will explain you how to get/list elgg entities based on some particular metadata_value. For example you may have 10 or 20 entities with a particular metadata called post_order and if you want to list these contents, then you can use the following option
$options = array( 'types' => 'object', 'subtype' => 'my_subtype', 'container_guid' => $container_guid, 'limit' => 10, 'offset' => 0, 'order_by_metadata' => array( 'name' => 'post_order', 'direction' => 'ASC', 'as' => 'integer'), 'full_view' => FALSE, 'pagination' => FALSE );
Now you can call this options in any elgg_get* or elgg_list* API’s like
- elgg_get_entities($options);
- elgg_list_entities($options);
- elgg_get_entities_from_metadata($options);
Thank you very much. It was great!