WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 29 of 32

jQuery Add Another Image Link

This code snippet is taken from my plugin, User Submitted Posts. It displays a link that users may click to add another file-upload input field.

WordPress Random Post Class

Here is a simple plugin that you can use to include a random post class for each post. With a slight modification it can be used to include a random body class. This function can be useful for applying random colors and styles to your blog posts. Or whatever.

Dead Simple Tooltips

Finding a decent tooltip script takes a lot of work, searching, testing, fiddling. Often, it’s much quicker and easier to simply roll your own, maybe starting from something very basic and simple. The problem is that finding a super simple starting point for tooltips is next to impossible; the few scripts that are available aren’t […]

WordPress Change Excerpt Length

This code snippet is SO easy.. check it out if you want to change the default number of words included by default in WordPress excerpts.

Check for PHP cURL

Quick snippet for checking whether or not PHP’s cURL is available on the server.

Auto-Height for Ajax-Loaded Content

Here is a jQuery function for automatically setting the height of Ajax-loaded content.

Get Current Post Type in the WordPress Admin Area

In WordPress, you can create posts, pages, or any custom post type. Within your theme template, you can get the current post type using the core WP function, get_post_type(). But that doesn’t work in the Admin Area. For example, my Disable Gutenberg plugin provides conditional functionality to the “Add New” and “Edit” screens based on […]

WordPress Change Default Number of Displayed Posts

By default, WordPress displays the same number of posts for the home page (when it is set to display posts) and all types of archive views. To change the default number of posts displayed for any specific view, you can add this simple function to your theme’s functions.php file.

PHP Stringify Formatted Text

This code snippet takes a string of text and removes all carriage returns, new lines, and tabs, replacing any matches with a simple blank space. An ideal way to “stringify” a potentially formatted lump of alphanumeric text.

Dealing with translation spam

How I respond to “translation spam”, which happens when greasy organizations ask permission to translate your script, extension, plugin, etc.

PHP Error Log Tricks

Super useful trick for customizing error logs when working with PHP.

Remove Linked Image Borders in IE

Internet Explorer has a nasty habit of displaying honking blue borders on linked images. This post shows a quick way to disable them using a slice of jQuery.