Skip to content

Wordpress Live Drafts Plugin – Patch

Last updated on February 12, 2017

I found Stephen Sandison’s Live Drafts Wordpress plug-in the other day and it’s been a godsend for the “publish place holder and then replace with final post” type of posts I publish on some of my other sites where I’m abusing Wordpress as a CMS. If you are looking for a way to have a draft copy of an update (including previews) of an already published post; this is the plug in you want.

That said, as a nitpicker, I found one minor detail that annoyed me to no end. The safe draft button was misaligned.

Alignment of save draft button when running Live Drafts as of version 3.0.1.

How it should look.

Correct alignment of save draft button.

With that in mind, I dug into the impressive short and clear source code (at least for a Wordpress plugin) and identified the problem which was quickly rectified with the patch below.

diff --git liveDrafts.php liveDrafts.php
index 0707b0e..93fa739 100644
--- liveDrafts.php
+++ liveDrafts.php
@@ -48,7 +48,7 @@ if (!class_exists('liveDrafts')) {
                     // Add save draft button to live pages
                     jQuery(document).ready(function() {

-                        jQuery('<input type="submit" tabindex="4" value="Save Draft" id="save-post" name="save">').appendTo('#save-action');
+                        jQuery('<input type="submit" tabindex="4" value="Save Draft" id="save-post" name="save">').prependTo('#save-action');

                     });

If you know how to apply a patch a source code file, you’re good to go. If not, or you want to make the fix though the editor in your Wordpress install, you’re looking for line 51 where it says “jQuery('<input type....“. You want to change the appendTo in .appendTo('#save-action'); at the end of the line to prependTo so the end of the line reads .prependTo('#save-action');.

Published inComputersSoftwareWordpress