Support » Plugin: Media Library Assistant » Alphabetical pagination

  • Resolved kevincowart111

    (@kevincowart111)


    Thank you again for all of your previous help. I have come up with a format that I believe will suit my needs but I have not seen anything in the forums that talk about how to achieve this.

    I would like to have an alphabetical pagination. Page 1 would include all files that start with the letter A. Furthermore, page 1 would be page A and the links would not be 1,2,3, they would be a,b,c.

    If this can be achieved, I have one more modification that I would like assistance on. The purpose for this page is for a song repository for my musicians to access. Every song has multiple files for each instrument. I need some kind of tab or expand system that would allow the user to click the name of the song and then the parts expand with the links. Have you had success with integrating other plugins that have to ability to do this with MLA?

    Ex.

    Song 1 (click to expand)

    Song 1 – vocals, guitar, saxophone, trumpet, bass

    Then the user could select the desired part. Below is the current code as well as the link to the active test page.

    [mla_gallery mla_viewer=true size=medium post_mime_type=application/pdf post_parent=all attachment_category=’groove-charts’ link=file columns=6 mla_target=”_blank” posts_per_page=12] [mla_gallery attachment_category=groove-charts post_mime_type=application/pdf posts_per_page=12 mla_output=”paginate_links,prev_next”]

    Member test

    https://wordpress.org/plugins/media-library-assistant/

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

    (@dglingren)

    Thanks for your kind words about previous support and for this interesting application idea. Thanks as well for putting an example together and posting a link to your site. That’s very helpful.

    I have been pondering your proposal since you first posted it. I have a few ideas but not yet a solution. There is no easy combination of plugins and shortcodes that will do exactly what you want.

    To begin, I suggest that “alphabetical pagination” is not really pagination, but rather a division of your song library by the first significant letter of the title. Pagination is a division of a large gallery into fixed-size pages to limit the maximum number of items returned on the page. Your song collection will have a variable number of items in each letter, e.g., not a lot of songs starting with the letter “X” (just a guess). What you really want is a two-level organization; a top level divided by first-letter and then an optional lower level to paginate letters with a large number of items. Does that make sense?

    If that’s right, you must construct a database query that returns only the items with the desired first-letter. I assume you are using the Title field; right? Do you need to handle “noise words”, i.e., if the title is “A New Day” does it go under “A” or “N” (New Day, A)?

    Finally, how do you want to show the “alphabetical division” controls on the page? A simple row of letters that, when clicked, go to the page for that letter? Some other display?

    For the second part of your proposal you wrote “click the name of the song and then the parts expand with the links“. There is a good WordPress plugin for this: Collapse-O-Matic. I am confident you could use this to get the results you need. First, though, you need a way of matching the song parts to their “parent” song. How does your application specify which part goes with which song?

    I believe your proposal can be realized by using the “hooks” built in to the [mla_gallery] shortcode to perform the first-letter database query. You will probably need a custom WordPress PHP template file to pull everything together and build the galleries. If you’re willing to consider a custom template and can answer the above questions and give me more information I can continue to investigate the best way to proceed. I will leave this topic unresolved until I hear back from you. Thanks for an interesting application proposal.

    Below are comments to your questions/statements.

    What you really want is a two-level organization; a top level divided by first-letter and then an optional lower level to paginate letters with a large number of items. Does that make sense?

    – this is exactly right

    I assume you are using the Title field; right? Do you need to handle “noise words”, i.e., if the title is “A New Day” does it go under “A” or “N” (New Day, A)?

    – Yes, I would use the title field and I do not need to hand “noise words”. “A new day” would go in the Letter A group.

    Finally, how do you want to show the “alphabetical division” controls on the page?

    – yes hyperlinks for letters A-Z at the bottom of the page the same way that pagination has 1- x.

    First, though, you need a way of matching the song parts to their “parent” song. How does your application specify which part goes with which song?

    – Since I do not have an already established database. I can set this up in whatever way you think best. Whether it involves renaming the original file name or adding information in MLA after upload, both are acceptable options.

    My only concern with the collapsomatic is that I need it to be simple to upload songs into the library incase other users with permissions want to do this. Adding fields in the MLA gallery seems simple enough.

    Thanks for the investigation. Hopefully this will benefit multiple users of your plugin.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for taking the time to give me more information on your proposal. I will do some experimenting and post my progress here.

    The only unanswered question – do you feel comfortable with a solution that requires adding a custom WordPress template file to your theme? I am not sure what your level of WordPress comfort/experience is.

    I’m not familiar with how to do this but I am definitely willing to learn and research in order to make this happen.

    Plugin Author David Lingren

    (@dglingren)

    Thank you for your patience while I attended to a number of MLA-related tasks (and to some house guests visiting from Guatemala).

    I am working on your application and have come back to the “you need a way of matching the song parts to their ‘parent’ song” issue. You indicated flexibility on this decision.

    Whatever the final decision is, every file uploaded to the site must have a unique name, and it seems reasonable that every original file on the client’s/uploader’s system must be unique. Some kind of file naming convention would be the simplest decision I can think of. Application logic can be added to process the file name(s) and amp the results into whatever database elements make sense.

    The only two rules needed are 1) that the song title be unique and 2) the title and its parts be separated by a unique sequence of characters that does not occur anywhere else in the file name.

    If you agree, then I propose that the separator is a three-character sequence; ” – ” (space, dash, space). For example:

    • Ain’t too Proud to Beg – Electric Bass.pdf
    • Ain’t too Proud to Beg – Guitar.pdf
    • Ain’t too Proud to Beg – Lyrics.pdf
    • Ain’t too Proud to Beg – Piano.pdf
    • Ain’t too Proud to Beg – Tenor Sax.pdf
    • Ain’t too Proud to Beg – Trumpet in Bb.pdf

    All of the above are acceptable file names on a Microsoft Windows PC. I assume they are acceptable on a Mac and other systems as well.

    WordPress will use the name part of the file name as the default attachment Title. WordPress passes all uploaded file names through its sanitize_file_name function before saving the file on the server. The corresponding server file names would be:

    • Aint-too-Proud-to-Beg-Electric-Bass.pdf
    • Aint-too-Proud-to-Beg-Guitar.pdf
    • Aint-too-Proud-to-Beg-Lyrics.pdf
    • Aint-too-Proud-to-Beg-Piano.pdf
    • Aint-too-Proud-to-Beg-Tenor-Sax.pdf
    • Aint-too-Proud-to-Beg-Trumpet-in-Bb.pdf

    Notice that the apostrophe has been deleted, the ” – ” separator has been shortened to a single dash and that other spaces (whitespace) have been replaced by a dash.

    Let me know if these two rules are acceptable. I am proceeding with my development using them for now.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA version 2.11. It includes an example plugin, mla-a-z-cloud-example.php.txt, that implements a solution for the alphabetical division and expandable song/parts gallery display application features.

    The example plugin contains two custom shortcodes:

    1. [az-cloud] – provides an “A-Z cloud” that tabulates the items starting with each letter of the alphabet and generates links that include a query argument with the selected letter.
    2. [az_gallery] – formats a “gallery” list of the items starting with the selected letter. It uses the file naming convention described in my previous post to collect all the “parts” of a particular “song” and display them as a second-level list. Uses Collapse-o-matic (optionally) to control the display of parts.

    Both shortcodes have parameters to filter by MIME type and/or taxonomy term and to change the HTML tags surrounding the items. Here are some examples of both shortcodes:

    <h3>The PDF Cloud</h3>
    [az_cloud attachment_category=song-part]
    <br> <br>
    [az_cloud post_mime_type=image/jpeg]
    <br> <br>
    [az_cloud post_mime_type=image/jpeg attachment_category=abc]
    <h3>The Song Gallery</h3>
    [az_gallery attachment_category=song-part mla_viewer=true]
    [az_gallery attachment_category=song-part mla_viewer=true az_listtag=p az_itemtag=div]
    [az_gallery attachment_category=song-part size=icon az_output=flat]
    [az_gallery attachment_category=song-part size=icon collapse_o_matic=false az_listtag=p az_itemtag=div]

    I am marking this topic resolved, but please update it if you have problems or further questions about using the example plugin to get the results you want. Thanks for your interest in the plugin.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20150625 that includes a new “Thumbnail Generation” capability. The Media/Assistant “Thumbnail” Bulk Action lets you select one or more non-image items and generate new thumbnail image items you can use as the Featured Image for those items. That lets mla_viewer display the thumbnails without re-generating them each time the gallery is composed. You can find step-by-step instructions for using the Development Version in this earlier topic:

    MLA errors when using plugin

    I am very interested in feedback on this new feature. If you get a chance to try the Development Version please let me know how it works for you. Thanks for your interest in the plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Alphabetical pagination’ is closed to new replies.