Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 121 of 219)

Articles, tips, and resources for WordPress-based development.

Two Tips for Writing WordPress Plugins

Occasionally, I’m asked for two quick tips or suggestions that I have for those who are just getting started with writing WordPress plugins.

WordPress Plugins

The assumption is that they’ve done all of the necessary leg work to get to the point where they are comfortable writing code and working with WordPress, but they want to avoid some of the pitfalls that many (or most?) of us experience when we first get started on our own projects.

Continue reading

Why I Recommend Array Themes

The WordPress theme market is at a weird place right now. Simply put, a lot of people will state the themes have now become a commodity. Sometimes, people consider this a bad thing, others consider it a more of a neutral fact that’s more or less a representation of where the WordPress economy currently sits.

Regardless of what your perspective may be, people still want to blog, people still need to have good-looking, functional websites, and people still need to have reputable places from which to purchase their themes.

And that’s why I dig (and recommend) Array Themes.

Continue reading

TinyMCE and WordPress: Adding User Input

In the previous post in this series, I showed how to add content to the post editor using a custom TinyMCE button. The problem with the approach, as we’ve covered thus far, is that the content that we’re adding to the editor is hard-coded.

We’re rarely going to want to be doing this, right? I mean, wouldn’t we rather grab input from the user and then add that to the editor?

My very own copy TinyMCE Editor. Show spectacular.

My very own copy TinyMCE Editor. So spectacular.

For some, this may be creating a shortcode based on some input, for others it may be grabbing input, making an Ajax call, and then putting the result of the request into the editor, or it may be something as simple as taking whatever input the user has provided in a prompt and then adding it to the editor.

Though the latter case is not likely something that is a realistic use case (after all, if they just wanted to put something into the editor, why not just, you know, enter it into the editor?), it’s something that will make rounding out this series a bit more complete because it will show how to connect displaying a prompt to the user, grabbing the input, then using the TinyMCE API to drop the input into the editor.

So that’s what we’ll do.

Continue reading

Get The Post Type of the Current Post with JavaScript

Whenever you need to get the post type for a given post, there are a couple of ways to do this:

  • If you’re in the dashboard, then you can use `get_current_screen()` and then access the `id` property of the object that’s returned. You can read more about this in the Codex.
  • If you’re on the front-end (or even in the dashboard, really), you can use `get_post_type`. This is also covered in the Codex.

But what if you want to grab the post type of the post that’s currently being edited on the client-side (read: via JavaScript)?

Continue reading

How To Save WordPress Submenu Page Options

If you’re using functions such as add_menu_page or add_submenu_page to create pages in the WordPress dashboard, it’s pretty easy to get something up and going, but what if you’re looking to actually save WordPress submenu page options?

Submenu Page Options

That is, let’s say you’re creating a page in the dashboard that’s tied to a new menu item – perhaps something that’s being added to the Tools menu – and you want to display some options among some other text or some other element or set of elements that you’re displaying.

It’s completely possible to use the Settings API to do exactly that, but it may also be a little heavy-handed for saving a couple a small set of options.

Luckily, WordPress has a hook that’s available that makes it pretty easy to save information like this that’s completely usable outside of the Settings API.
Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑