Support » Plugin: Document Gallery » Filtering media with multiple categories

  • Resolved Mario

    (@mmeliaiha4healthorg)


    Hello,

    First of all, Great plugin!

    DG works fine with single categories for me but when media has multiple categories, the filtering doesn’t work and will display all media in, I think, the last category specified.

    [dg category=2011,Affordable_Care_Act relation=AND localpost=false]

    The above shortcode should only display media with the category “2011” AND “Affordable_Care_Act”. It displays other media with categories “2012” as well.

    What am I doing wrong?

    Mario

    https://wordpress.org/plugins/document-gallery/

Viewing 8 replies - 1 through 8 (of 8 total)
  • try using [dg category=”2011, Affordable_care_act” relation=AND localpost=false]

    I found the quotes are essential for categories.

    Note: it does not use slugs, but the actual name. For example, a category called: ‘Affordable Care Act’ must be category=”Affordable Care Act” or it will look for each word without the quotes.

    Hope that helps. If the language is not perfect, I’m hoping the insight will help you figure it out.

    Mario

    (@mmeliaiha4healthorg)

    Thanks for the reply.

    I tried adding the quotes and same thing. I also made sure I was using the category names too. I even deleted the categories and removed the underscore. Still won’t filter properly and it’ll show everything even if none of the categories match.

    For example:
    pdf1 = affcareact, yr2011
    pdf2 = collab, yr2012

    [dg category=”affcareact,yr2012″ relation=AND localpost=false]

    The above shortcode should only display pdf1 but it shows both. I’ve got hundreds of pdfs to add and I must be able to filter by year and category. It only works if I specify one single category but that won’t work for me. Thanks!

    Mario

    Mario

    (@mmeliaiha4healthorg)

    I’m still trying different variations of code looking for a solution.

    [dg category=”affcareact,yr2011″ relation=AND localpost=false]
    This one shows anything with either affcareact or yr2011

    Also tried: (saw this on a different thread)
    [dg category=”affcareact” category=”yr2011″ relation=AND localpost=false]
    This one shows anything with the yr2011 category only.

    Still not working… Please help.

    Also, I’m using Media Library Categories to create and manage the categories.
    https://wordpress.org/plugins/wp-media-library-categories/

    Plugin Author Dan Rossiter

    (@danrossiter)

    Hi Mario,

    I apologize for taking so long to respond. Dealing with remodeling my home and work so haven’t had a ton of time to spare.

    The issue you are running into is that relationships are currently only handled between different taxons. For example, if your shortcode was [dg category="affcareact" category2="yr2011" relation=AND localpost=false] then you would get exactly what you are expecting.

    All of that said, this will be changing with the next release. The other person working on this plugin, Demur, developed a solution that will instead utilize the relation parameter across multiple taxons and across multiple terms for a single taxon (the latter being your situation).

    This code is not yet released, but if you are interested in testing out the functionality (feedback definitely appreciated) then you can copy the code from here and copy the contents (File->Save As in your browser) and paste to your server (through FTP) at WP_ROOT/wp-content/plugins/document-gallery/inc/class-gallery.php.

    Failing that, we’ll have the official release out as soon as possible. Documentation needs to be updated before we can push the changes out.

    Thanks for your patience!

    -Dan

    PS: If you’ve found this plugin useful, please take a moment to rate it. Thanks! 🙂

    Mario

    (@mmeliaiha4healthorg)

    Thanks for the reply. I’ll wait for further updates.

    I did implement a temporary workaround by attaching specific year PDFs to a single specific year page and filtering then by a single category.

    I’ll close this thread for now and will keep an eye out for that update.
    Thanks!

    Mario

    Plugin Author Dan Rossiter

    (@danrossiter)

    Thanks for your patience and understanding, Mario!

    PS: If you’ve found this plugin useful, please take a moment to rate it. Thanks! 🙂

    Plugin Author Dan Rossiter

    (@danrossiter)

    Hi Mario,

    I believe you’ll find the Taxonomy changes just released in 2.3.1 address the issues you were having.

    Please given them a shot and let me know if you run into any issues with their functionality!

    -Dan

    PS: If you’ve found this plugin useful, please take a moment to rate it. Thanks! 🙂

    Mario

    (@mmeliaiha4healthorg)

    Hi Dan,

    I just wanted to report that the plugin is working fantastically!

    The time arrived for me to remove my temporary workaround. I was able to filter by two different categories and accomplish exactly what I was attempting to do. Nice job!

    Mario

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Filtering media with multiple categories’ is closed to new replies.