Category / Notes

Throughout this series, I’ve been talking through the process of how go about adding a TinyMCE button to WordPress – specifically, adding a custom button to the post editor.

Up to this point, I’ve covered a number of different things. Namely:

– Stubbing out the plugin and adding the JavaScript
– Including any dependent files that you may need in order to power your plugin
– And how to bootstrap the plugin so that it is able to be activated from within WordPress

The thing is, we haven’t actually made anything happen in the editor let alone even introduce a button into the actual editor yet. In this post, we’ll do exactly that.

Remember that when adding a button to the post editor in WordPress, a portion of the code is going to be writing a plugin for the TinyMCE editor (since that’s what the actual post editor is).

In a sense, you’re placing a plugin within a plugin. That is, you’re placing a TinyMCE plugin within a WordPress plugin.

Anyway, in an attempt to modularize the code, you’ll likely have at least a couple of files that power the plugin – one of which that will be specifically for the TinyMCE button and one of which that will be specifically for other logic that fires when the button is clicked (like displaying a modal or something like that).

If you’re interested in adding a TinyMCE button to WordPress, then this series of articles aims to do just that. In the first post of the series, I walked through some of the basic things that need to be done in order to get started with adding a custom button.

I laid out the file organization, the basic plugin structure, some of the foundational JavaScript, and started working on the hooks that are necessary for adding a custom button.

As it stands right now, the functions responsible for adding a new button aren’t actually defined within the context of a class much less hooked into the plugin itself. So in this post, we’ll take a look at exactly how to do exactly that.

Starting with this post, I’ll walk through the process for how we can go about adding a TinyMCE button to WordPress in projects for ourselves or clients.

Yesterday, when I was sharing some thoughts on the nature of WordPress Menus and The Customizer I ended up on a tangential series of thoughts on my opinion and perspective on the nature of the social Internet. Then I cut it if for no other reason that it was off topic. Anyway, the original content included my thoughts on […]

/ June 14, 2015 / Comments Off on A One Week Break From Twitter

A One Week Break From Twitter

I rarely, if ever, make any kind of posts like this because they’ve always struck me as somewhat meta and I think that they can sometimes represent oneself as if they are more important than they really are. So here’s a big shot of my profile to disprove that :). But seriously, maybe that’s what will happen from […]

/ May 25, 2015 / Comments Off on Memorial Day 2015

Memorial Day 2015

In the United States, today is Memorial Day in which we honor and remember those who have died during service to the country.

Occasionally, I’ll get questions via Twitter or email from those who are working with the Settings API and aren’t sure why certain values are saving when they shouldn’t actually be saving. For example, say you have an input field that’s asking for, say, a company’s name. You obviously want to sanitize the data to make […]

Yesterday, I talked about some of the advantages of using IDs when working with various pieces of WordPress data and populating different input elements, saving it to the database, and more. For certain types of data, this works well; however, this may not always be true especially as it relates to data types such as […]

One of the features that I’ve often found myself having to implement when building custom solutions for others is implementing some type of select box – be it multi-select or single select – or another similar input element that’s [naturally] populated with a list of option elements. These options may consist of posts, pages, custom […]

Starting with WordPress?
Hosted By
Hosted By SiteGround