WordPress.org

Support

Support » Plugins and Hacks » WP Document Revisions » [Resolved] [Plugin: WP Document Revisions] Adding post thumbnail support

[Resolved] [Plugin: WP Document Revisions] Adding post thumbnail support

Viewing 5 replies - 1 through 5 (of 5 total)
  • I’ve found the solution by reading through some other comments on the thread posted above, so hopefully it’ll help someone else.

    Whilst in the loop, you need to query the post for any attachments and then foreach through the attachments using wp_get_attachment_image to get the actual image itself.

    It’s a workaround, but works well for me and I love the fact that the document manager automatically creates post thumbnails for uploaded images.

    The way you describe is for fetching the thumbnail, right?

    However, upon uploading the thumbnail, the document still gets overwritten with the thumbnail as a new revision. So this is only ok when you use this plugin for managing images, which is what you probably do bigspring?

    So, when using the plugin for documents (pdf’s in my case), the question remains, how do we add thumbnail support without it being hijacked by the document revisions?

    That’s right, I was talking about fetching the image.

    To summarise what I found about adding the post thumbnail – you can’t add post thumbnail support as it will overwrite the actual download file itself.

    However, if the file you uploaded if a valid image type (jpg / gif / png) then a post thumbnail is actually created without you having to specifically set one. You can then use the wp_get_attachment_image function to return the post thumbnail that’s silently created.

    Plugin Author Ben Balter

    @benbalter

    Thumbnails are not fully supported right now. This is due to a limitation on how files are uploaded. Given the media upload experience, there’s no (easy) way to know when a user intends to upload a thumbnail for a document, and when they intent to upload a new version. The workaround would most likely to be some sort of “add thumbnail” button, etc., which would bipass the normal logic of uploading a new version.

    If anyone would like to take a first pass at this, pull requests are always, more than welcome. I created an issue on GitHub to track the new feature ( https://github.com/benbalter/WP-Document-Revisions/issues/33) and will close this support thread for the time being.

    Thanks for letting me know.

    Although it’s probably not intended, post thumbnail support (kind of) works if you’re uploading an actual image as the document, you just need to make sure you use wp_get_attachment_image rather than the_post_thumbnail.

    Obviously doesn’t work if you’re uploading a non-browser compatible image (eg. TIF) or other file type (doc / xls / pdf / etc).

    Might be worth mentioning that on the documentation somewhere. It’s not ideal, but will probably keep most people going until one of us has time to submit a pull request.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: WP Document Revisions] Adding post thumbnail support’ is closed to new replies.
Skip to toolbar