WP-Mix

A fresh mix of code snippets and tutorials

SMS Text API Services

I’ve been wanting to build a “server uptime” app that optionally sends a text message to alert users if certain conditions are met. I can build the app part myself, but needed a solid way to send the SMS messages. In my pursuit of a solution for this, came across several reasonably priced solutions. Thought […]

Fix “Function Not Found” Error in WordPress Must-Use Plugins

Posting these notes in case they are useful to anyone looking for related information. This may or may not be related to must-use plugins. I am still testing on vanilla WordPress installation. Update: after some further experimenting, it looks like the issue was resolved by uploading a fresh set of WordPress core files. So try […]

Whitelist File Names via Apache/.htaccess

I’ve posted tons of tutorials showing how to block things with Apache/.htaccess. Generally blocking involves defining a list and then forbidding access to it. In this quick post, we’re going to change it up, by defining a list and forbidding access to anything that is not included. The list can be anything, IP addresses, request […]

WordPress Remove Query Strings from Scripts and Styles

I’ve had this post sitting here unpublished for a while now. Thought it’s finally time to post and share with anyone who may be looking for it. Basically here are two ways to remove query strings from the URLs of any registered scripts and styles. Let’s take a look..

Customize WordPress Allowed Tags for Comments

By default, the WordPress comment form enables users to include basic HTML tags in their comments. This includes tags like <p></p>, <br />, <strong></strong>, and so forth. These basic tags suffice to add basic formatting in most cases. But for some setups, more tags may be needed.

Vanilla JavaScript: Focus Input on Page Load

Super quick tutorial today. How to focus the user on any input when the page loads. For example, when you visit the WordPress Login Page, the “Username” field is focused automatically. This technique is very simple and works on any input or element that supports a focused state.

PHP: Get $_SERVER Variables

I use a variation of this function to get super global $_SERVER variables in my free shapeSpace WordPress theme. The function returns all relevant variables contained in the $_SERVER array. Note this is a general PHP technique, so WordPress is not required for this one.

Affinity Photo: Transparent Gradient

I switched from Photoshop to Affinity Photo several years ago. Although the overall image editing process is very similar to Photoshop, there are some things that Affinity Photo does differently. For example, doing a simple gradient transparency. Seems easy but it took me quite a while to figure out how to do it. So am […]

WordPress: Get Current URL and Slug

Another essential tool for your WordPress development toolbox is getting the URL of the current page. This sounds simple but can be tricky depending on which page or type of page is being displayed. So to help, here is a simple technique to get the current URL for any single post, archive view, custom template, […]

WordPress: Simple Image Upload with jQuery

Some of my free WordPress plugins enable users to select and upload files from their local machine. The uploaded images are handled by WordPress and added to the Media Library. The technique is very basic and easy to implement, requiring only a few snippets added to your WordPress site.

Find All URLs in a String with PHP

While developing my WordPress chat plugin, SAC Pro, I needed a way to get all URLs from a string. This enabled me to find any URLs that were included in chat messages, so I could apply HTML formatting and convert the raw URLs into actual clickable hyperlinks.

WordPress: Customize Read More Links and Text

Here are two code snippets that are useful for customizing the “read more” link. The read more link is displayed on archive views like category archives, author archives, posts archives, search results, and so forth. You also will find the read more link displayed on the site’s homepage and on any page where posts excerpts […]