Creates a Preview and Publish/Update Button in post creation/post edit, that scrolls down the screen as you scroll. No more scrolling back to the top of the editor to hit preview!
The plugin uses minimal code and only a little CSS. Buttons and the tab use default WordPress admin CSS classes.
I’m still learning! So I am slowly working on adding the functions needed to translate this and make it useful to non-English speakers. Please bear with me. I’m currently tagging the strings, which should give no discernable problems. Until I figure out the .po/.pot files anyway.
The [s] on the tab will eventually save the post with AJAX, or at least create a post revision. I’ve not successfully managed it yet, so this is currently commented out.
In order these will be addressed:
- Word Count My method of calculating this has been improved. On an article where the editor said I had 2196 words, my method returns 2199. So I’m nearly there.
- The [s] does not work as intended (and is, therefore, hidden).
- In your WordPress Admin, go to “Plugins → Add New` and search for FibroJedi.
- Click/tap Install
- Click/tap Activate
1. Upload the whole plugin folder to your
2. Go to the Plugins page and activate the plugin.
3. Your new tab will appear on the right hand side whenever you edit a post or page.
Where is it intended to be used?
FJ-SPPB is a back office plugin and has not been tested with Gutenberg features. Others are welcome to modify it to suit their needs. But I originally made this for me, and I use Classic Editor, so I guess that’s the primary user base.
What Does It Do?
This tiny plugin’s primary role is to create a tab on the right hand side of page/post editor, containing the key “publishing” actions that usually sit at the top of the editor. As you scroll down the page – or writing your content makes the page longer – FJ-SPPB scrolls with you.
As I made this for myself originally, there are a few other features, most of which can be switched off if you do not want them:
- Word Count at the last save/publish action.
- Close for Now: depending on your window size, this will either be a [X] or a circular (X) symbol. This hides the tab until the next save/publish action.
- Confirmation Dialog: get prompted when pressing [Save Draft], [Update] or [Publish].
How Does It Work?
FJ-SPPB does not run the code to save, update or preview your posts. Instead it simulates a click on the default buttons. Thus, what you would expect those ones to do, FJ-SPPB does. See it as a handy shortcut or scrolling bookmark!
Are there any options?
Yes! Under the Settings menu, look for Sticky Preview Buttons. There you can set:
- [0.3] Show the Word Count
- [0.3] Distance tab appears from the top of the editor.#
- [0.3] Opacity of the tab when a cursor is not over it.
- [0.3] Whether or not you want a link to the plugin’s settings on the tab itself. This link opens in a new tab/window rather than interrupting your editing. Changes will reflect whenever you either publish or save/update, or if you reload/refresh the editor.
- [0.4] Whether you want to enable the sliding effect (large screens only)
- [0.5] Whether you want to add a prompt when using the tab’s Publish/Update button. Note: The normal buttons function however they would have before you added my plugin. I have not altered their behaviour, only the ones on my tab.
I’m open to suggestions on future features, but it already does what I wanted it to. I didn’t want to overdo the settings. It might be other features would be better done as add-on plugins.
以下人員參與了開源軟體〈FibroJedi's Sticky Preview and Publish Buttons〉的開發相關工作。參與者
- Sliding Effect put into options, so that, if you have a resolution of >=1200px you can keep it visible rather than have it slide away.
- [Bug Fix]: The (X) link was hiding the button area inside the tab, but not the whole tab. This has now been fixed.
- [Update]: The word counting method has been rewritten and is now much closer to the number given in the editor.
- [NEW] (Screens/Resolution >= 1200px) FJ-SPPB now slides off to the right so it’s not overlapping metaboxes. Hover over it to use buttons and it’ll slide back when you’re not hovering (the cursor, not you). Animation done through CSS so is browser-dependent, but most modern browsers should be fine with this.
Next Version: I will make this an option within FJ-SPPB’s settings.
- [Formatting] Reduced the link to settings to the same font size as the word count. Added space between those two (relevant only when both are enabled in settings.)
- Checked compatibility with WordPress 5.9
- [Bug Fix] Switching the [Settings] link off did not work in some cases. This has been fixed.
- New Options for the Sticky Tab!
** Show/Hide Word Count
** Show/Hide link to Settings
** Set distance from the “top” of the screen from 10% to 80%. Higher than 80% not available in case it gets pushed off the screen.
** You can now set an opacity for the tab, which lets you see other metaboxes behind it. Opacity will always be 100% when your cursor is over it. Users of tablets or other touchscreens where you choose not to use a mouse/trackpad should keep this at its default of 100%;
- [X] link to close the tab until next save/publish action, now appears as a blue circle on the right on resolutions >=1000px to make it more intuitive. <1000px screens will get the lightweight [X] as before.
Note: “top” is calculated from the top of the top meta box, rather than the top of the screen, so that you don’t cover up Screen Options, Help etc in the top bar.
- Added link to SPPB settings in the Plugins list.
- moved the ‘top’ attribute from the external CSS and added it inline.
- [Bug Fix] Activation error in some cases. Apologies, that one’s my bad. All tested and working now.
- Bug Fix: [Save Draft] button now correctly appears in the tab on new pages or posts that have not yet had an actual official draft saved (post_status = “auto-draft”). This has been tested and works as intended.
- Bug Fix: [Preview] no longer attempts to preview a new post that does not yet have a title/assigned permalink. This prevents an error 404. Once the title field is completed, [Preview] continues as normal.
- Added word count estimate. Not because I thought others needed it, but I did.
** It is intended to set this as an optional extra in a future release rather than on by default.
- Confirmation dialog when using the [Update] and [Publish] buttons. This does not affect the functionality of the default buttons at the top of the editor.
- Added [Publish], [Update] and [Save Draft] buttons
- Added the “hide for now” link.
- Initial Version with just the [Preview Changes] button
- Retroactive Patch: Updated function names with fibrojedi_ prefix as opposed to fj_ per guidelines.