Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Adam Bissonnette

    (@mmanifesto)

    That’s definitely do-able. What would be the complete rules though? If you can find a GPL library online somewhere that does this in a single function that would be super handy ??

    Rules your example has:

    • Stripe file extension
    • Replace -‘s and _’s with spaces (would there be more)
    • First letter in each word is capitalized (would this rule only be applied to all words or just a set few?)
    Thread Starter Schalk Joubert

    (@schalkjoubert)

    Hi,

    The ay fileaway does it is works well:
    https://www.evernote.com/l/ASG3yZ5aU6hLzanYSMcWkVFNLxSCMCkMmfg

    But your suggestion of stripping out ‘-‘ and ‘_’ and replacing with a space, and the capitalise the text should do the trick! ??

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Ok – I’ve pushed out a version 1.8 which you should be able to update to and try this out. I’ll do another update to ~1.9 in a week or so with documentation once we finalize the defaults etc…. and any new formats that need to be added.

    With 1.8 you can add prettyname=”true” to the shortcode and it will strip out the -‘s and _’s and file extension etc… I also added a regexstrip parameter in case you want to get rid of extra stuff like 150×150 or other parts of filenames that wordpress auto generates.

    The Date Modified and Extension are also available to use – you can see them by adding/changing format=”li2″ in the shortcode. If you use custom content templates you can also pipe in the new date / extension with {date} / {ext} respectively.

    My idea behind extension was that you could add your own styles to add icons for the filenames (e.g. adding a bit to the custom template <span class=”extension mm-{ext}”></span>). Then adding something to your css to style that with your icon of choice or font awesome icon or whatever – if you’d like help with this I can provide you a snippet of css to drop into your style.css file for a bunch of extensions.

    Let me know how this works out for you and please give the plugin a 5/5 review so my ego is sated ??

    Thread Starter Schalk Joubert

    (@schalkjoubert)

    Hi,
    Thank you for the quick work.
    I added a review!

    I tried to use the date, but it seems that it only works for list view and not table, is that correct?

    [MMFileList folder=”FAIS Circulars” format=”table”]<div class=””>{name} {date} ({size})</div>[/MMFileList]

    Thank you,

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Yes, I left out changing the different formats because I was a bit concerned it’d interfere with existing usage of the plugin. I did add fomart=”li2″ which displays all the new content in a bulleted list.

    To get you the most out of the formatting for table what would you think about a shorcode like this:

    [MMFileList folder=”FAIS Circulars” format=”table” headings=”Nom,Date,Taille,Type”]
    <tr><td>{name}</td><td>{date}</td><td>{size}</td><td>{ext}</td></tr>
    [/MMFileList]

    This would let you customize the column headings and still have full control over styling each row (in case you want to use the {ext} value as a class or something to add icons in).

    Thread Starter Schalk Joubert

    (@schalkjoubert)

    That sounds perfect!
    Thank you very much indeed.

    I really hope more people will find this useful ??

    Plugin Author Adam Bissonnette

    (@mmanifesto)

    Ok – I’ve pushed out another update which should bump us to version 1.9 which includes the changes I mentioned. One thing to keep in mind is that I couldn’t include the <tr> tags without WordPress adding in a bunch of
    tags so I’ve added a wrapper for it. To use the new custom template code for the table please use the following formatting:

    [MMFileList folder=”FAIS Circulars” format=”table” headings=”Nom,Date,Taille,Type”]
    <td>{name}</td><td>{date}</td><td>{size}</td><td>{ext}</td>
    [/MMFileList]

    Using the pretty filenames you just have to set prettyname=”true”. If there is other text that you want to replace and you know a bit of regex then you can use the regexstrip parameter as well (e.g. if you have a pretty filename like: LogoFile 150×150 – you can include regexstrip=”/\\d*x\\d*/” and the “150×150” will be removed from anything of the names).

    As long as these updates help you then I’m happy to do the updates. If you can try this out and let me know if you run into any problems then I’ll be able to get bug fixes in before updating the documentation letting all the other users know how to use the new features.

    I think I’ll try to work towards a version 2.0 that includes all the new documentation and either a setting to enable or disable file download counts or a hook to connect to another plugin for counting link clicks (since there doesn’t seem to be a realy good “Simple” plugin for that right now).

    I really like this plugin. Regarding the pretty file names, where does the plugin get that information? Is it from the file itself? On my computer, I can give microsoft office documents titles, but I can’t do it with pdfs (I don’t know if this is always the case or not).
    Thanks,
    Clay

    Just as an FYI, I tried giving a word document a title and then converting to pdf…the title was removed. This was using Adobe Acrobat X.

    Thanks,
    Clay

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Pretty File Names’ is closed to new replies.