WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 21 of 36

Stop WordPress from adding bundled plugins and themes during updates

By default, WordPress installs its bundled themes and plugins every time the software is updated. So for example, if you’re running the Hello Dolly plugin and a new version is available, WordPress will update the plugin when you upgrade WordPress.

Force download WMV with .htaccess

Everyone loves WMV! Not! Jokes aside, here’s what finally worked for me when trying to force download Windows Media Video (WMV) files.

WordPress Trigger 404.php Template

Recently I needed a programmatic way to trigger a 404 error in one of my free WordPress plugins. Fortunately WordPress makes it very easy to do. This quick tutorial explains two different ways to make it happen.

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 […]

jQuery prevent widows

While redesigning DigWP.com, I was experimenting with different layouts for the comments section. In one of those layouts, I needed to prevent widows in the comment text (when it comes to cleanly displayed text, widows are the worst). So after some playing, I came up with a couple of jQuery snippets that work great. Here […]

PHP Get Memory Usage vs. Total

Here is a useful function that I modified for my WordPress plugin, Dashboard Widgets Suite. It returns an array containing the current memory usage and the total memory usage, so you can get and display a ratio of the values as needed.

Must-Use (mu) Plugins & Drop-Ins

Two little interesting tidbits about WordPress: must-use (mu) plugins and drop-ins. Do you know them?

Shortcode for encoded email address

One way to help reduce spam is to encode your email address whenever displaying publicly. Here is a function that will do just that: display an encoded version of whatever email address you specify.

CSS3 & HTML5 Cheatsheets

Two excellent cheatsheets for anyone working with CSS3 and HTML5.

Strip Slashes from PHP Magic Quotes

Here are a couple of functions to strip or remove slashes (i.e., backslashes) from variables when PHP magic quotes are enabled on the server.

Browse your local files via browser

Ultra-quick tip for viewing/browsing files on your local machine in any browser.

WordPress Sidebar Template Code

When developing my free WordPress starter theme, I end up with lots of sweet code snippets that for whatever reason didn’t make the final cut. For example, the sidebar template was recently refactored with shiny new code. So what to do with the previous sidebar code? Delete it? Nah, instead I would rather share it […]