WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 19 of 36

PHP: Target IE less than 9

Recently I haven’t had time to bother with old versions of IE (less than 9), so I use the following PHP function to target IE 6, 7 and 8.

WordPress Load Order

Micro-post today, on the load order of WordPress..

CSS Target Opera

Here are some nice CSS techniques for targeting old and new versions of Opera.

Use your own custom email with Gmail

Quick guide for using your own custom email with Gmail.

Fix Database Won’t Start Error for MAMP Pro

I use MAMP Pro for some of my local pet projects and development. Normally it works great, but the other day I couldn’t get MySQL started. It kept crashing during startup. This post explains the related errors and how I managed to resolve the issue and get MAMP working again.

jQuery align elements with the grid

When working on a CSS grid, here’s one way of aligning variable-height elements, such as blocks of pre-formatted code, advertisements, and so on.

jQuery Auto Resize Multiple Textareas

The User Notes Widget that’s included in my Dashboard Widgets Suite plugin enables users to edit notes right on the WP Dashboard. To make things extra awesome, each note automatically expands as the user types more lines of text. This post explains how I achieved this trick, aka multiple auto-resize textareas.

Display Twitter count in plain text

Twitter’s constant changes make it necessary to update techniques for otherwise simple tasks such as displaying your Twitter count via PHP.

jQuery Get Number of Paragraphs

Quick jQuery code snippet to get the number of paragraphs in the specified element. The technique can be modified easily to get the number of any element.

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.

WordPress shortcodes for private content

I use these snippets all the time, so I’m posting them here at WP-Mix for easy access. The first shortcode can be used to display content only to logged-in users (based on capability). And the second shortcode can be used to display content only to visitors (non-logged-in users).

Remove All Matching Options from the WordPress Database

Typically when you want to remove an option from the WordPress database, you can use a function like delete_option(). But there are cases where such functions are insufficient. For example, in a previous version of my plugin Blackhole for Bad Bots, a database option is added for each blocked request, and each option name includes […]