Retrieve Attachment ID from Image URL

Especially when developing plugins or theme settings that make use of the WordPress media uploader to upload and insert images, being able to retrieve the ID of the image uploaded can be extremely useful. By grabbing the image (attachment) ID, you suddenly have a lot more control over what you can do with the image,…

Create Database Tables When Plugin is Activated

Using custom database tables for your WordPress plugins is one of the way that you can greatly improve the kind of plugins you are able to create. DB tables give you a way to manage, organize, and save data for your plugin, and creating them for your plugin is very simple.

Load Scripts if Post has Short Code

This is a really handy trick that I just learned today. Whenever we can, it is always best to only load styles and scripts for our plugins when they are needed. This tutorial will show you how to load stylesheets and scripts only when a post contains the short code that the styles / scripts…

Change “Enter title here” Text for Custom Post Types

Custom Post Types are an increasingly popular tool for WordPress developers to use when constructing their plugins. There are many, many little tricks that help to make the finished product more polished, and one of those is changing the “Enter title here” text that is displayed in the Post Title field on the edit screen.…

Simple Recent Posts Widget

This next part in our Working with Widgets Series is going to show you how to create a simple recent posts widget, much like my Better Recent Posts Widget plugin, though it will be even simpler. The goal of this tutorial will be to demonstrate a very useful technique that you can use in countless…

Simple WordPress Widget Template

Widgets are utilized by tons of WordPress themes and plugins as a way to display customized content in various locations, and they’re relatively easy to create, as long as you have the appropriate resources. The code below will give you everything you need to make extensive and advanced widgets that can do anything you want.…

Load Scripts on Plugin Pages Only

Loading scripts, CSS and jQuery, within a plugin for use on admin pages is one of the most common areas that developers make mistakes. If you plugin’s administrative pages require any scripts that are not already loaded in WordPress by default, you should always ensure that those scripts are only loaded on your plugin’s page,…