Good to hear from you again. Thanks for your question and for including the link to your earlier MLA forum topic.
There are two ways to access [mla_gallery] results, depending on the type of results you want returned. First, you can use the WordPress do_shortcode() function to execute the [mla_gallery] shortcode and return the HTML markup for the gallery display. The second method is more like the function get_results_from_search_mla($queries) example you gave, and is outlined below.
MLA has four supported public functions including one function much like your example. They are defined in the /plugins/media-library-assistant/includes/class-mla-shortcodes.php file. Here is the declaration of the function that might interest you:
/**
* Parses shortcode parameters and returns the gallery objects
*
* Compatibility shim for MLAShortcode_Support::mla_get_shortcode_attachments
*
* @since .50
*
* @param int Post ID of the parent page/post or zero
* @param array Attributes of the shortcode
* @param boolean Optional; true to calculate and return ['found_posts'] as an array element
* @param boolean Optional; true activate debug logging, false to suppress it.
*
* @return array WP_Post[]|int[] Array of post objects or post IDs.
*/
public static function mla_get_shortcode_attachments( $post_parent, $attr, $return_found_rows = NULL, $overide_debug = NULL ) {
This function is used in the following MLA Example plugins, where you can see how it is used:
- MLA Gallery Download Archive
- MLA Multi-search Example
- MLA Multiple WP Query Example
- MLA Parent Search Example
- MLA Custom Feed Example
- MLA Multisite Extensions
- MLA UI Elements Example
The $attr parameter accepts an array of shortcode parameters as defined in the Documentation tab for the shortcode, e.g., $attr = array( 'post_parent => 'all', 'post_mime_type' => 'application/pdf' );
The default return value of the function is an array of WP_Post objects, but you can add fields=ids to the attributes to get just the ID values of the selected items.
I will be adding more of this information to the Documentation tab, but that should get you started. I will leave this topic unresolved in case you have problems or further questions regarding the above suggestions. Thanks for your continued interest in the plugin.
It has been six weeks since the last post in this topic. I hope the suggestions I provided were helpful.
Your question inspired me to take another look at the functions provided in the class-mla-shortcodes.php file and I have made a number of improvements to that file. They are included in the latest v3.09 version of the plugin.
I am marking the topic resolved, but please update it if you have problems or further questions regarding the solutions outlined above.