WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 20 of 35

Random WordPress Snippets

Just a collection of miscellaneous & random WordPress snippets for your enjoyment.

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.

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

.htaccess template for custom directory views

Here is an .htaccess template for displaying a customized directory with file view enabled, such that all files except for those indicated are displayed as a list.

The Right Way to Include Google Fonts in WordPress

This tutorial explains the right (and wrong) way to include (aka enqueue) Google Fonts in your WordPress theme.

Live comment preview with JavaScript

Here is a simple way to display a live comment preview for any comment or contact form using ordinary JavaScript.

Update WordPress Post With Current Time

Here is a simple technique for updating WordPress posts with the current date and time. Useful for timezone/server transfers.

Browse your local files via browser

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

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.

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

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.

Structure of $_FILES array

Working with USP Pro involves a lot of $_FILES manipulation. I tend to forget how the array is structured, so I’m posting it here for ez reference.