• Resolved roym1

    (@roym1)


    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

    (@dglingren)

    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.