Template File Loaders in Plugins

Template files are very standard for themes and heavily used in child themes. For example, if a user wants to modify the layout of their site pages, they can simply copy page.php from their parent theme to a child theme, modify the HTML structure, and the changes will be reflected on the site. While it’s…

The dangers of the gettext filter

The gettext filter is a really handy filter that I’ve written about before. The filter provides a way to easily change international-ready text via a simple filter call, but it can also have a serious impact on performance if overused.

Get array of all URLs in a string

WordPress 3.7 introduced a new function called wp_extract_urls(). This is a handy function that allows you to extract URLs from text strings. Simply pass the text string to the function and it will return an array of URLs.

User Follow System – Part 7

In this final part of the User Follow System tutorial series, we will create two short codes, one for displaying a follow/unfollow link for a user and one for displaying a list of recent posts from users you (the currently logged-in user) follow. We will wrap up the series by also showing a few areas…

User Follow System – Part 6

In part 5 of this tutorial series we wrote the Javascript that is responsible for firing off the ajax events when a user is followed or unfollowed. Now, in this part, we are going to write the PHP side of the ajax events that takes care of processing the requests and sending a response back…

Building good template files

It is becoming more and more common for plugins to provide template files that can be copied to a theme’s folder and then safely modified. This means that the site owner that is using the plugin can add, remove, and modify the markup of the plugin without hampering the upgrade process when new versions are…

Checking if a dependent plugin is active

When you write plugins that depend on others, such as extensions for Easy Digital Downloads, you often need to check if the dependent plugin is active and only perform certain actions if it is. There are several ways to check if a plugin is active and I’d like to walk you through some of them.

Using the WordPress Heartbeat API

WordPress 3.6 introduced a new API called the “WordPress Heartbeat”. This is the API that behind a lot of the improvements in WordPress 3.6, including better revision tracking, user’s session management, and more. I’m going to show you a quick example of how you can use the API to perform “live” actions. What is the…