WordPress.org

Ready to get started?Download WordPress

Forums

Google Doc Embedder
Automatic GDE (6 posts)

  1. cr.aguila
    Member
    Posted 3 years ago #

    After a lot of researches, and giving up a few times on the issue of making the GDE plugin to appear automatically, I had finished up putting on a GDE button to tiny mce to simplify the issue (using the Adding a TinyMCE button to WordPress - Brett Terpstra tutorial), but still not automatic.
    Today, just looking for something else I've found the "Auto Attachments" plugin (i needed it to put on a video gallery which didn't worked out with that plugin), but I realized that plugin detected the file type of all the attachments in a post and displays a download link. I thought maybe the code is not that complicated and i can replace the link tag by the [ gview ... Checking the auto-attachments.php in the editor my surprise was that the code to display the file link was a very easy to understand HTML, which diplayes an image with a img tag, and a link with the a tab. That's when i decided to do some changes to see if it works, and it worked! so I'm copying the edited part of the code, for the people who needed this just like me can have their own automatic GDE!

    Go into the auto-attachments.php (in the wordpress plugin editor) and look for " // Function Area "
    under this you will be editing the way to see the pdf files. Then 15 lines from there you will see the a list of lines starting with "$sAttachmentString", just replace all of them with this 3 lines

    $sAttachmentString .= "<div class='dI'>";
    		$sAttachmentString .= "[gview file='$file_link']";
    		$sAttachmentString .= "</div>";

    Then you will want to do the same with the Word, Powerpoint and Excel documents, just go a little further and you will find "//Word Documents", "//Powerpoint Documents" and "//Excel Documents". with the same structure of the pdf file, just replace the same lines in each case.
    Finally you need that the files are shown to fit the width and height. To do this, go to the a-a.css file (still in the plugin editor in WordPress) and look for the line which starts with .dI
    you will need to replace the width, with your blog contents width (where the posts are shown) and to delete the height:....; part so you will have something like this:

    .dI {width:650px;float:left;margin:0 5px 0 5px;text-align:center;}

  2. cr.aguila
    Member
    Posted 3 years ago #

    Of course you need to install the Google Doc Embedder plugin and the Auto Attachments plugins, i take no credits on this, this is only a modification of a plugin.

  3. k3davis
    Member
    Plugin Author

    Posted 3 years ago #

    This implementation is interesting. I've tried in the past to add a media button to WordPress (the Upload/Insert line above the editor) but without full success. Most of the how-tos one finds online are for versions prior to 3.x and my php creativity is a bit gimped. Adding a button to the editor is another way to go which I didn't consider because I almost never use the visual editor... but it's worth investigating. This particular implementation seems a bit too complex but is a good point of direction. I'll see what I can do.

  4. cr.aguila
    Member
    Posted 3 years ago #

    I've also made some other changes to the auto-attachments.php file, including another plugin which shows/hide something between the [hide-this-part] shortcode, that way it loads the file only when the user want to see the file, saving some bandwidth. (that plugin is called "hide this part")
    If you want to I can send you the auto-attachments.php file edited, I think it could be a good implementation for the GDE plugin.
    The only thing I couldn't do is to upload files directly to the attachments from an email using the wp-mail.php file.

  5. k3davis
    Member
    Plugin Author

    Posted 3 years ago #

    Thanks for your work! I am in the midst of making some trial changes on my end that integrate GDE with the editor based on your idea, but I think I'm going about it differently than you did. I don't really want to rely on multiple extra plugins to add the functionality, I think that's asking too much. For now I think I will integrate with the editor the ability to insert the shortcode with selectable options, but without the upload facility that I'm guessing the Auto Attachments plugin is providing you. This is still a positive step even though the upload must still be done separately.

    My first preference is to use the media upload facility already built into WP for that function - I just haven't been able to get it to work. As mentioned my php is slightly lacking and the examples I find online (such as this one) are old or incomplete for a plugin that handles more than just image insertion. I wish that I could find a plugin that adds something to the media bar - the "Upload/Insert" bar above the editor itself - so that I might be able to reverse engineer it a bit. I know they are out there but I haven't found one as yet.

    I'm pleased with how the editor integration is coming though - building and inserting the shortcode for the user will be a step up, even without the integrated upload for now. I think we have different ideas about it but you definitely sent me off in a good direction.

  6. k3davis
    Member
    Plugin Author

    Posted 3 years ago #

    An updated, stable beta has been posted (2.0b3) that adds TinyMCE and Quicktag integration, as well as other minor in-process fixes and changes. It's available from your plugin list if beta notifications aren't turned off, and from the plugin home page.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic