• Resolved osxxso

    (@osxxso)


    I have tried adding the following shortcode to a test page and it returns blank…

    [mla_gallery attachment_category=’minutes’]

    The following shortcode works fine and displays all the PDF documents in my media gallery…

    [mla_gallery post_parent=all post_mime_type=application/pdf size=icon link=file]

    I have multiple documents in the media gallery with Att. Categories “Minutes” and slug “minutes” so I’m not sure what’s going on?

    Thanks…

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter osxxso

    (@osxxso)

    This worked…

    [mla_gallery post_parent=all post_mime_type=application/pdf size=icon attachment_category=minutes link=file]

    Thanks..

    • This reply was modified 5 years, 6 months ago by osxxso.
    Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and especially for taking the time to work it through and report success before I could get to it.

    As you discovered, the [mla_gallery] shortcode has a default post_mime_type=image setting that prevented your PDF documents from being included in the gallery display. Also by default, [mla_gallery] will only display items “attached” to the current post/page, which is why post_parent=all is required in your second example.

    If you code something like attachment_category=minutes to filter the gallery the default “attached to” setting is turned off, so you final shortcode could be a bit simpler:

    [mla_gallery post_mime_type=application/pdf size=icon attachment_category=minutes link=file]
    

    I will leave this topic resolved, but please update it if you have any problems or further questions regarding the above explanation. Thanks for your interest in the plugin.

    Is this something I can use to add dynamically to a page any and all items of a type/category within a date range, or Order it Descending? So whenever I add something to the Media Library with that Category, it’ll show up in that page with code?

    Plugin Author David Lingren

    (@dglingren)

    @hmeader

    Thanks for your question. Yes, you can use the [mla_gallery] shortcode to display a gallery of items assigned to a specific category (or Att. Category) and you can order and/or filter the display by date. For example, you can display the ten most recent items:

    [mla_gallery category=some-term orderby=date order=DESC posts_per_page=10]
    

    or change category=some-term to attachment_category=some-term if you are using MLA’s Att. Categories taxonomy. You can add post_mime_type=all to display non-image items like PDF documents.

    You can compose a more elaborate date query to restrict items to a particular date range. More information can be found in the ‘Date and Time Parameters, the “date query” ‘ section of the Settings/Media Library Assistant Documentation tab.

    If you have problems or further questions regarding the above suggestions, please open a new support topic so I can give you more specific guidance. Good luck with your application!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘shortcode attachment_category not working’ is closed to new replies.