WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 4 of 30

PHP Spoofing Headers with cURL

While working on a recent book-sale script, I needed a way to test various request headers. This script is what I used to spoof just about everything except the IP address (which it seems is not possible to spoof via PHP/cURL).

WordPress Do Stuff on First User Login

Here is a code snippet that runs the first time a user logs in to their registered account. Useful for sending custom welcome emails, or whatever.

WordPress enqueue user-agent stylesheets

WordPress makes it clean and easy to enqueue custom stylesheets via the functions.php file. Here’s how to do it for user-agent stylesheets.

PHP Detect All Versions of IE

Quick code snippet for detecting all versions of good ’ol IE (Internet Explorer).

PHP: Get current URL

Nice lil slab of PHP to get the current URL. Useful for a wide variety of applications, nice one to have in the tool belt.

PHP Get Server Information

Here are some scrap PHP scripts leftover from my work on Dashboard Widgets Suite. These functions were considered specifically for use with the System Information Widget, and provide a variety of details about the current server configuration and software setup.

WordPress Get Category ID from Slug

Quick WordPress snippet for getting the category ID from the category slug.

Difference between home_url & site_url

Here are some notes to help discern the subtle (and oft-confusing) differences between the WordPress functions, home_url and site_url (and their related “get” functions, get_home_url and get_site_url). We’ll look at the output of these functions and how they relate to the WordPress General Settings.

Remove ‘Private’ from private post titles

By default, WordPress prepends the string “Private: ” to all posts marked as “private”. Here’s a quick function to remove the private prefix and move on with your life.

Disable or customize WP read more link

Quick snippet for customizing or disabling the WordPress “read more” link for the_excerpt().

Add links to HTML/CSS Validator

Here are some notes and markup examples for adding links to the W3C’s online HTML and CSS validators. This will enable your visitors to check any page on your site.

Display Images with User Submitted Posts

Here is a quick recipe for displaying linked images for images submitted with the User Submitted Posts plugin.