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 […]
WP-Mix Celebrates 11 Years
Celebrating 14 years online! WP-Mix launched back in 2012 as a simple code snippets site. It’s just a place where I can stash and share useful code snippets and tutorials. There are over 400 published posts and another 300+ draft posts. I could publish all those drafts “as-is”. But a lot of them are just […]
PHP: Two Ways to Check if Remote File Exists
Working on my free WordPress plugin, Simple Download Counter, I needed a quick way to check if a remote file exists. As in, requesting the file returns a 200 “OK” response. Here are a couple of ways to do it via PHP.
Display All PHP Errors on Screen
When working on a PHP project, I usually log any errors to a file (error log), but on some projects it’s necessary to display any errors right there on the page. Here is the code that I use to make it happen.
Responsive CSS for Simple Ajax Chat
Thank you to Benjamin S. for sharing this CSS snippet for my free WordPress plugin, Simple Ajax Chat. Simple Ajax Chat (SAC) provides a setting that makes it easy to add your own custom CSS/styles. So today we’re going to take advantage of that option to customize the appearance of the SAC chat box so […]
Over 300 SQL Code Snippets for WordPress
I’m excited to launch my latest book, Wizard’s SQL Recipes for WordPress. Years in the making, Wizard’s SQL Recipes brings together over 300 recipes for managing and optimizing the WordPress database. If you’re a WordPress administrator or developer who wants to level up their database skills, this book’s for you. Check out the PDF Demo […]