WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 32 of 35

Two interesting WordPress infographics

Here are a couple of interesting infographics for WordPress. Interesting to get a larger view of the WP universe :)

WordPress Create Shortcode

Ultra-quick guide to help you create a WordPress Shortcode. Aimed at experienced WordPress users who need a basic example of how to create shortcodes.

WordPress: Add “View HTML” Button on Edit Post Screen

On a recent project, I found myself viewing the HTML source for every post and page on a WordPress-powered site. After about a thousand clicks, I decided to write a code snippet that adds a “View HTML” button (it’s actually just a link) for each post row displayed on the WordPress “Edit Post” screen. So […]

WordPress s2member PayPal Fix

For those using s2Member and getting no response after clicking the “Continue” button on the PayPal.com site, here is a quick possible solution.

Notes on @media queries

Just a couple of notes for working with CSS @media queries: two ways to write media queries and how to query portrait vs. landscape orientation.

PHP: Remove Empty File Data

This quick function does one simple thing. It removes empty file data from a PHP files array. As you may know, the structure of the $_FILES array is sort of backwards from what normally would be expected. Because of this, removing empty file data from the array requires some extra wrangling. So to make things […]

JavaScript & jQuery: Add Style to Fragment Identifier

It’s easy to style a <div></div> by targeting its ID. But what if you only want to add style when a specific fragment identifier is targeted via the URL? So for example, your page at /about/ has a table with all the data. When visitors arrive directly at /about/, no extra styles are added. But […]

Redirect Attacker to Special Message

If you are using Apache server, you can stop an attack by getting the IP address of the attacker and then using it to block or redirect all of their requests. Normally I just block the requests using either Deny or Require directives (depending on Apache version), but sometimes it’s fun to redirect the attacker […]

Get WP, PHP, and SQL Info

Here are some sweet code snippets for getting various types of server information. Includes more functions for getting and/or checking various types of WordPress, PHP, and SQL data. Strictly plug-&-play for quick reference and copy/paste usage.

jQuery Fade Out Element

Here is a simple jQuery technique to fade out any element on the page. It uses jQuery’s .hide() method to animate the fade-out of the specified element.

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.

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.