Title: mla_gallery
Last modified: December 22, 2021

---

# mla_gallery

 *  Resolved [roym1](https://wordpress.org/support/users/roym1/)
 * (@roym1)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/mla_gallery/)
 * Hi again, wondering if we can push one step further and limit the number of files
   it returns. So far my shortcode looks like this:
 * [mla_gallery attachment_category=news-release post_mime_type=application/pdf 
   link=file size=none meta_key=”_wp_attached_file” orderby=meta_value order=DESC]
 * I have this at the bottom of my page but would prefer it to return the 5 most
   recent news releases. I use the widget title to link to the News Release page
   where I would also like to make it so I can pull news release files of a certain
   year. I assume my base shortcode should still look like this:
 * [mla_gallery attachment_category=news-release post_mime_type=application/pdf 
   link=file size=none meta_key=”_wp_attached_file” orderby=meta_value order=DESC]

Viewing 1 replies (of 1 total)

 *  Plugin Author [David Lingren](https://wordpress.org/support/users/dglingren/)
 * (@dglingren)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/mla_gallery/#post-15189322)
 * Thanks for the questions and for including the source text of your shortcodes;
   very helpful.
 * You want to “**_return the 5 most recent news releases_**“. You can limit the
   number of items returned by adding “Pagination Parameters” to your shortcode.
   To return five (or fewer) items you can add `posts_per_page=5` to the shortcode.
 * Your current shortcode is sorting the gallery by file name. To return the five
   most recent items you can modify the `orderby` and `order` parameters. For example:
 * `orderby=date order=DESC` or `orderby="date DESC"`
 * The above will sort on the date & time the items were added to the Media Library.
   You can modify the “Uploaded on” date in the Edit Media screen or the Media/Assistant
   Quick Edit area if you need to. You could also create a “publication date” custom
   field and sort on that or continue to use the file name if it contains appropriate
   values.
 * To “**_pull news release files of a certain year_**” You can use the “Simple 
   Date Parameters”, e.g., `year=2021` or the more powerful “Date and Time Queries,
   the date query” for filtering by other date values. You can find more information
   in those sections of the Settings/Media Library Assistant Documentation tab.
 * I hope that gets you started on a solution for your application. I am marking
   this topic resolved, but please update it if you have problems or further questions
   regarding the above suggestions. Thanks for your continued interest in the plugin.

Viewing 1 replies (of 1 total)

The topic ‘mla_gallery’ is closed to new replies.

 * ![](https://ps.w.org/media-library-assistant/assets/icon-256x256.png?rev=973502)
 * [Media Library Assistant](https://wordpress.org/plugins/media-library-assistant/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/media-library-assistant/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/media-library-assistant/)
 * [Active Topics](https://wordpress.org/support/plugin/media-library-assistant/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/media-library-assistant/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/media-library-assistant/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [David Lingren](https://wordpress.org/support/users/dglingren/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/mla_gallery/#post-15189322)
 * Status: resolved