Post Editor Buttons Fork

Add custom buttons to the HTML mode editor toolbar.

This is a fork of Oren Yomtov’s plugin.

Unsure of the reason behind the poor rating and “doesn’t work” vote. Possibly the user didn’t realized this only adds tags to the HTML editor? If you use this plugin and it works for you, I’d appreciate it if you’d give my a good star rating and an “it works” vote.

Conversely, if you have trouble, please post to the forums, and/or ask me on twitter (@trepmal).

If you need this to work on WordPress < 3.3 download 2.2.1.

Download

Latest version: Download Post Editor Buttons Fork v2.3

Installation

  1. Upload the post-editor-buttons directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Visit the plugins page by clicking the Use link in the plugins description or from the Settings admin panel.

That’s it, now you can start adding your own buttons.

FAQ

Q. I don’t see the buttons I’ve created. Where are they?
A. This plugin creates buttons for the HTML editor only.

Q. Can I put classes/styles or other attributes inside the tag?
A. Yes, but you must use single quotes. For example, this will work:

<h2 style='color:#ff0;'>

But this will not:

<h3 class="clear">

As of version 2.1, will be replaced with automatically
As of version 2.3, quote marks should be preserved

Q. Why are my inline styles are being removed?
A. Some styles are removed by WordPress while others aren’t. For example, this will work:

<span style='color:red;'>

But this will not:

<span style='display:none;'>

These styles are being removed when the provided tags are passed through one of WordPress’s sanitation filters. I’m currently investigating the best way to get around this.

Q. Why isn’t this tag/attribute being saved?
A. When you save a custom button, the before/after pieces are filtered. No point in creating a button that adds something that’ll only be removed when you save a post, right?

To allow additional tags, you’ll need to add some code. (I recommend add it to your functions.php file so it will be preserved if you update the plugin).

Here’s how to allow the video tag

add_filter( 'admin_init', 'allowed_tags' );
function allowed_tags() {
    global $allowedposttags;
    $allowedposttags['video'] = array();
}

To add more attributes (in this case, src, type, poster):

add_filter( 'admin_init', 'allowed_tags' );
function allowed_tags() {
global $allowedposttags;
    $allowedposttags['video']['src'] = array();
    $allowedposttags['video']['type'] = array();
    $allowedposttags['video']['poster'] = array();
}

Changelog

2.3

  • Uses QTags API introduced in WordPress 3.3
  • Uses new Help Tabs method introduced in WordPress 3.3
  • Info on allowing additional tags/attributes added to help tab.
  • Better handling of quote marks in tags

2.2

  • Fixed issues for non-administrators

2.1

  • Rework of how custom javascript is saved
  • General cleanup and clarification

2.0

  • Initial fork release

6 thoughts on “Post Editor Buttons Fork

  1. Pingback: Download Post Editor Buttons 2.0 | Free Web Script

  2. Hi, I tried to activate the Fork, thanks for building it. But got this message:
    Fatal error: Cannot redeclare peb_init() (previously declared in /home/nova/public_html/wp/wp-content/plugins/post-editor-buttons/index.php:31) in /home/nova/public_html/wp/wp-content/plugins/post-editor-buttons-fork/post-editor-buttons.php on line 40

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>