WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 14 of 35

jQuery check inline CSS property

Working on my WordPress plugin, Dashboard Widgets Suite, I needed a quick function to check a property defined via the inline style attribute on a specific element. Here is an easy, plug-n-play solution that works great.

Rename uploaded files in WordPress

Here is a function used in my free WordPress plugin User Submitted Posts that enables you to rename WordPress media uploads. So for example, if the user uploads a JPG image named “sweet-ride.jpg”, the following function will append a random string to rename the file “sweet-ride-random.jpg”, where “random” is a random alphanumeric string containing 20 […]

Disable Combined Scripts in the WordPress Admin Area

If you’ve ever tried to debug JavaScript or CSS for pages in the WordPress Admin Area, you know that it’s next to impossible to sort out which files contain which scripts. Why? Because WordPress combines them all at runtime into a single, concatenated script. It’s referred to as concatenation, and it helps to reduce the […]

Coda 2 Shortcuts

This post is a working roundup of any/all useful shortcuts that I can find for Coda 2 (code editor and FTP software). So far, most of the shortcuts in this post are taken from Brad Strickland’s great post*. So huge thanks to Brad for sharing.

PHP trap for bad bots

Another effective trap for bad bots and spammers, built with PHP and a slice of .htaccess.

Replace content in WordPress header.php

Here’s how to filter content in WordPress’ header.php template file using PHP.

WordPress link attachment to parent post

This tutorial provides four techniques for linking WordPress attachment pages back to their parent posts. Adding such a link makes it easy for users to view an image or other attachment, and then quickly navigate back to the original gallery in the parent post.

Exclude category in WordPress

Ever wanted to exclude a category in WordPress? Turns out it’s pretty easy to do without having to install another plugin.

Shorten text with CSS

There are several ways to shorten text, depending on the situation and goals. It’s preferable in most cases to shorten text server-side via PHP, but also possible to shorten via jQuery or even CSS.

CSS Dark Pre Tag Styles

Here is a quick CSS snippet for adding some smooth, dark styles to any <pre> tag. One-step snippet for complete pre styling: add to your stylesheet and done.

Cron database backups via email

Here’s a simple, effective, and practical way to keep regular backups of your database using cron. After setting up the cron job, backups of your database are sent to you via email.

Simple jQuery tooltip

There are many great jQuery plugins for creating tooltips, but for simple cases only a few lines of code are needed.