Automatic GDE
-
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;}
- The topic ‘Automatic GDE’ is closed to new replies.