Support » Plugin: Media Library Assistant » Problems with PDFs

  • Resolved annettes


    I have only just started using Media Library Assistant and am having trouble understanding how to do some things. I have created the following short code to display all my PDFs on the page above:

    [mla_gallery post_mime_type=application/pdf post_parent=all link=file mla_viewer=true columns=5 size=icon-only mla_viewer_width=20 mla_viewer_height=20  mla_viewer_best_fit=true mla_viewer_resolution=300 orderby=date order=desc]

    I have included a lot of options because it wasn’t working the way I expected. The PDFs are displayed, but my problems are:
    1. I would like the icons to be about half the size they are but the size options don’t seem to work.
    2. When you click on an icon the document is not displayed.
    3. In the media library, can I allocate a category to multiple files at once or do I have to do each one individually?
    4. When I click on a file in the Media Library to view the attachment details on the RHS of the screen, the Attachment category and Attachment tags section are displayed with a “<- Click to toggle” link that I have to click to be able to see the details. Can I have this open all the time so I don’t have to click to toggle?
    Thanks so much for your help. It is a fantastic plugin.

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

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


    Thanks for the positive feedback and for your questions. Thanks as well for the link to your sample page; very helpful.

    I know that MLA is a large plugin with lots of features and options. I appreciate the effort you’ve made to find what you need.

    The “Thumbnail Substitution Support, mla_viewer” feature provides a way to generate thumbnail images for PDF documents uploaded to older versions of WordPress (before WP 4.7). It looks like your documents have thumbnail images generated by WordPress, so the mla_viewer feature is not helpful.

    Your shortcode contains size=icon-only, which you may have found in an earlier topic. The value should have an underscore, not a dash, i.e., size=icon_only. The dash is confusing [mla_gallery] and you are getting full-size document thumbnails in the gallery display. Most of your documents do not have captions, so you might want to try size=icon or size=thumbnail to get smaller versions of the thumbnail images.

    Regarding your numbered questions:

    1. Smaller icons – You can try the suggestions above to change your size parameter. You sample page has thumbnail images, not icons.
    2. Not displayed – It looks like you have some sort of “lightbox” feature in your theme or another plugin. It is overriding the behavior of the link=file parameter. I can see a data-gallery="gallery" attribute in the item links behind the thumbnails that is added by the theme/plugin. There should be some way of disabling the lightbox, but this depends on which theme or plugin you are using.
    3. Assigning multiple files – If you go to the Media/Assistant admin screen you can use the Bulk Edit area to assign terms to multiple files at once. You can click on the “Help” menu in the upper right corner to learn more about this and other features of the Media/Assistant submenu. Let me know if you need more specific help.
    4. Auto-fill – You are using the Media Library “Grid” view, I believe. You can open the taxonomy boxes at all times with an MLA option setting. Go to the Settings/Media Library Assistant General tab and scroll down to the “Media Manager/Media Grid Enhancements” section. Check the box next to the “Media Manager auto-fill meta boxes” option, then scroll to the bottom and click “Save Changes” to record the new setting.

    I hope the above suggestions are helpful. I will leave this topic unresolved for now in case you have problems or further questions about the solutions I’ve outlined. Thanks for your interest in the plugin.

    Thread Starter annettes


    Hi David,
    Thanks for your fast and detailed response:
    Q1 – I removed from the shortcode anything related to mla_viewer so that I now have this: [mla_gallery post_mime_type=application/pdf post_parent=all link=file columns=5 size=thumbnail orderby=date order=desc]
    But whether I use size=icon or size=thumbnail I get the same size images and they have a poor resolution. What else can I try to get smaller images please?

    Q2 – solved – I was able to switch off the lightbox.

    Q3 – I added categories to all my PDFs, then added category_name(newsletter-archive) to my shortcode. However it still displays all the Pdfs, not just those from the specified cateory. What am I doing wrong?

    Q4 – solved.
    Thanks again for your help.

    Plugin Author David Lingren


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

    Regarding your “Q1”, the large, fuzzy thumbnail images are displayed because of CSS styles supplied by your theme. If you look at lines 524-543 in the /wp-content/themes/transcend_pro/core/css/base.css file you will see:

    /* WP GALLERY */
    .gallery { margin:0 auto 30px; }
    .gallery .gallery-item { float:left; display:block; margin:0 0 3% 3%; text-align:center; width:48.5%; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; }
    .gallery .gallery-item:hover { }
    .gallery .gallery-icon { text-align:center; padding:5px; margin:0; overflow:hidden; line-height:0; border:1px solid rgba(0,0,0,0.1); }
    .dark .gallery .gallery-icon { border:1px solid rgba(255,255,255,0.2); }
    .gallery-columns-2 .gallery-item { width:48.5000%; }
    .gallery-columns-3 .gallery-item { width:31.3333%; }
    .gallery-columns-4 .gallery-item { width:22.7500%; }
    .gallery-columns-5 .gallery-item { width:17.6%; }
    .gallery-columns-6 .gallery-item { width:14.1666%; }
    .gallery-columns-7 .gallery-item { width:12.5714%; margin:0 0 2% 2%; }
    .gallery-columns-8 .gallery-item { width:10.75%; margin:0 0 2% 2%; }
    .gallery-columns-9 .gallery-item { width:9.33333%; margin:0 0 2% 2%; }
    .gallery .gallery-item:first-child,
    .gallery br + .gallery-item { margin-left:0; }
    .gallery dl a { display:block; }
    .gallery dl a img { width:100%; height:auto; margin:0 auto; }
    .gallery .gallery-caption { 	font-size:12px; line-height:1.2em; margin:10px 0 0; }
    .gallery br+br { display:none; }

    The line .gallery dl a img { width:100%; height:auto; margin:0 auto; } is overriding the width of the thumbnails. I am not a CSS expert but I believe you can fix this by editing the base.css file or, better, applying a custom style template to your [mla_gallery] shortcode. That will avoid problems with other galleries in the site that rely on the theme’s styles.

    You will need a custom Style Template that looks like this:

    < style type='text/css'>
    	#[+selector+] {
    		margin: auto;
    		width: 100%;
    	#[+selector+] .gallery-item {
    		float: [+float+];
    		margin: [+margin+];
    		text-align: center;
    		width: [+itemwidth+];
    	#[+selector+] .gallery-item .gallery-icon img {
    		width: auto;
    		border: 2px solid #cfcfcf;
    	#[+selector+] .gallery-caption {
    		margin-left: 0;
    		vertical-align: top;
    < /style>

    To create the Style Template:

    1. Navigate to the Settings/Media Library Assistant Shortcodes tab.
    2. Click on the “Style” view just above the templates table.
    3. Hover over the “default (default)” Style entry (for the Gallery shortcode) and click the “Copy” action link.
    4. When the page refreshes, the “Edit Template” screen will appear.
    5. Change the template Name to (for example) “annettes”.
    6. Make the changes you need to match the custom template show above. In particular, add the width: auto; line to the #[+selector+] .gallery-item .gallery-icon img styles
    7. Make sure to remove the spaces in the two “style” HTML tags, which I had to add to the code example.
    8. Scroll to the bottom and click “Update”.

    Once that’s done you can add the template to your shortcode:

    [mla_gallery post_mime_type=application/pdf post_parent=all link=file columns=5 size=thumbnail orderby=date order=desc mla_style=annettes]

    As I wrote, I believe the styles in the custom template will override those in the theme.

    Regarding your Q3, I am guessing that your term assignments are in the Att. Categories taxonomy supplied by MLA; is that right? If so, you must add attachment_category=newsletter-archive to your shortcode in place of the category_name parameter. That parameter only works for the WordPress “Categories” taxonomy.

    I hope the additional answers get you the results you need. I am marking this topic resolved, but please update it if you have any problems or further questions regarding the above suggestions.

    Thread Starter annettes


    Perfect! Thank you so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problems with PDFs’ is closed to new replies.