• Resolved sgclark

    (@sgclark)


    I’ve used some of the features of MLA for a while but am now venturing into trying out the MLA Gallery. I really want to use the ‘pagination’ capability. I have lots of image galleries on my site and some get quite long. Breaking them up with this capability would be really great.

    All of my media is currently organized based on “media_category” using WP’s ‘normal’ gallery taxonomy, however I can’t figure out how to use this within the [mla_gallery …] shortcode.

    As an example, here is a typical WP gallery shortcode that I use for the page noted below

    
    [gallery link="file" orderby="title" columns="3" size="medium" media_category="2579"]
    

    Is there a way to use ‘media_category’ within the [mla_gallery…] shortcode. Going through all my images to re-categorize them would be very tedious and prohibitive. And if I’m missing something obvious, my apologies!

    thanks
    Stephen

    • This topic was modified 3 years, 7 months ago by sgclark.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for including the source text of your [gallery] shortcode; very helpful.

    WordPress core does not have taxonomy support for Media Library items, but there are many plugins that add it, including MLA. It looks like you might be using the Enhanced Media Library plugin, which implements a media_category taxonomy.

    You can add the Media Categories taxonomy to MLA easily:

    1. Navigate to the Settings/Media Library Assistant General tab.
    2. Scroll down to the “Taxonomy Support” section.
    3. Check the “Support” box in the Media Categories row.
    4. You can also check the “Inline Edit” box to add Media Categories to the Bulk Edit and Quick Edit areas on the Media/Assistant admin submenu.
    5. You can also check the “Terms Search” box to add the taxonomy to the “Search Media/Terms” list.
    6. Scroll to the bottom of the page and click “Save Changes” to record you new setting(s).

    Now you can add something like media_category=media-category-slug to the [mla_gallery] shortcodes. Note that MLA uses the slug, not the term ID. You can find the slug on the Media/Media Categories taxonomy edit screen in the “Slug” column.

    I am marking this topic resolved, but please update it if you have problems or further questions regarding the above suggestions. Thanks for your interest in MLA.

    Thread Starter sgclark

    (@sgclark)

    Hi

    Thanks for the response. I followed the 6 steps to add “Media Categories” (media_category) to MLA, however you lost me on the 2nd to last paragraph (Now you can add…).

    Is this what you mean? Please see screen shot below.
    https://www.dropbox.com/s/3mgywnssgc3dkmw/Screen%20Shot%202021-04-26%20at%209.34.53%20AM.png?dl=0

    So if this is correct, how does this now manifest itself into the [mla_gallery...] short code? So thinking about the example I provided earlier, I was interested in making the gallery on the “NCAA” page a multi-paged gallery. The ‘media_category’ ID for that is 2579.

    How would the MLA Gallery short code now be configured? How would I specify/call the images in that specific category based on the previous example (id=2579) to make a paginated gallery?

    [mla_gallery media_category=media_category ]

    [mla_gallery media_category=2579 posts_per_page=40 mla_output="paginate_links,prev_next"]

    I will hack around with this on my side but any further detail and context would be appreciated.

    Thanks
    Stephen

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the additional information. I regret that the final steps of my explanation were not clear. The “Media Taxonomies” tab in the EML settings is fine; no changes required there.

    To filter an [mla_gallery] by a media_category term you first need to find the slug for the term whose ID is 2579; EML uses IDs, but MLA uses slugs. For example, suppose the term whose ID is 2579 has the name “Atlantic Sun” (wildly random guess). You would go to the Media/Media Categories taxonomy page, find the “Atlantic Sun” term and see that the slug value is something like atlantic-sun. Then you would use the slug in your [mla_gallery] shortcodes. For the example you gave you would code:

    [mla_gallery media_category=atlantic-sun posts_per_page=40]
    
    [mla_gallery media_category=atlantic-sun posts_per_page=40 mla_output="paginate_links,prev_next"]
    

    Both shortcodes must select the same items so the pagination matches the gallery content. In you case the data selection parameters are media_category=atlantic-sun and posts_per_page=40.

    I hope that clarifies things and gets you going on the results you need. Post an update if you have any problems or further questions regarding my suggestions. Thanks for your patience.

    Thread Starter sgclark

    (@sgclark)

    Ah, ok. Got it. Yeah that makes sense. The slug for that category (ID 2579) is NCAA. So its

    [mla_gallery media_category=atlantic-sun posts_per_page=40 mla_output="paginate_links,prev_next"]

    Very cool. I’ll start playing with this and see if this can work with my galleries! Thanks so much for clarifying!

    Stephen

    Thread Starter sgclark

    (@sgclark)

    OK. So something is not working. I put the shortcode

    [mla_gallery media_category=ncaa posts_per_page=150 mla_output="paginate_links,prev_next"]

    Into the WordPress/Gutenberg “Short Code” field however it is only outputting the pagination/links to the different paginated “pieces” of the gallery. No images are showing up. Aplogies if I’m being dense and missing something.

    See link below:
    https://www.sgclark.com/test-ncaa-gallery/

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your updates with the progress you’ve made. Regarding your latest post, you can find the answer plus additional information and examples in the “Support for Alternative Gallery Output, e.g., Pagination” section of the Settings/Media Library Assistant Documentation tab. For example:

    IMPORTANT: Pagination controls are an alternative output, not an additional output. One shortcode can generate either a gallery display or pagination controls. You will need two or more shortcodes to get both the gallery and the controls.

    In other words, you will need both of the shortcodes I gave in my last post to get the gallery display as well as the pagination controls.

    Since you have chosen posts_per_page=150 you might find it better to put the pagination controls above the gallery display instead of or in addition to the controls at the bottom of the gallery.

    Let me know if you have any problems or further questions.

    Thread Starter sgclark

    (@sgclark)

    This is awesome!!

    I’ve been playing around with all of this and the ‘test’ gallery with pagination is looking great. You can see it at the link below. I put 150 in the previous sample just as a placeholder. That was way too many, as you implied. I reduced the number of images to 51 per page but I’m still at 15 gallery pages!

    https://www.sgclark.com/test-ncaa-gallery/

    For the Pagination on the top of the gallery I have
    [mla_gallery media_category=ncaa posts_per_page=51 mla_output="paginate_links, prev_next"]

    For the Pagination on the bottom, I have
    [mla_gallery media_category=ncaa posts_per_page=51 mla_output="paginate_links, show_all"]

    I do have a couple of minor questions:

    1. Is it possible to “merge” the two methods I note above so I have the Previous/Next links (prev_next) displayed along with all the links to each gallery page (show_all) rather than the truncated view at the top? I tried a few combinations and nothing seemed to work.

    2. From reading the specs, I got the sense I could possibly change/substitute the numerical pagination (1,2.3…) to Alpha (Ab-Be, Be-Sa,…). Is that in fact possible?

    I’m sure I’ll have other questions but that should be it for now. This may be ready for prime-time! ??

    Thanks
    Stephen

    Plugin Author David Lingren

    (@dglingren)

    Thanks for the update with the good news regarding your progress.

    You asked “ Is it possible to “merge” the two methods I note above…? You can accomplish this by using multiple pagination shortcodes. Try coding something like this:

    <table>
    <tbody>
    <tr>
    <td>[mla_gallery media_category=ncaa posts_per_page=51 mla_output="previous_page,wrap"]</td>
    <td>[mla_gallery media_category=ncaa posts_per_page=51 mla_output="paginate_links,show_all"]</td>
    <td>[mla_gallery media_category=ncaa posts_per_page=51 mla_output="next_page,wrap"]</td>
    </tr>
    </tbody>
    </table>
    

    I have wrapped the shortcodes in an HTML table to get them displayed on one line. There are many variations on this idea you can play with.

    Regarding your second question about “alphabetical pagination”, there is no support in the core MLA plugin for this application. You may find something you can use in this earlier support topic:

    Alphabetical pagination

    Thread Starter sgclark

    (@sgclark)

    Thanks for the additional details on both questions.

    Regarding the “Previous” and “Next” item, since I have 15 ‘gallery pages’, I just added mla_end_size="8" to the shortcode and that way, whenever someone is on a page, both “Prev” and “Next” will show unless they are on the first or last page (which would be an expected UX).

    I pushed MLA’s pagination out to the main NCAA gallery on my site (https://www.sgclark.com/wallpapers/ncaa) to ‘kick the tires’ and see if it is a better way to get to the different items in the gallery. And I will try out the Alpha approach you linked to.

    Thanks for all your attention and help here.

    We can close this out!

    Thank you
    Stephen

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and the link to your final result. The mla_end_size idea is a great alternative to the approach I suggested.

    I will leave this topic resolved. If you have problems or questions regarding the alphabetical alternative, start a new topic and I will give you what help I can.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Create MLA Gallery using “media_category”’ is closed to new replies.