WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 12 of 36

WordPress Example Child Theme

Here is a ready-to-go example Child Theme that you can download and use on your own WordPress-powered site.

Secure WordPress Login Page

If you try to log in to some of my WordPress-powered sites via the WP Login Page, you will be met with a 403 “Forbidden” response. For sites where I am the only registered user, I lock things down to prevent endless waves of drip force attacks. It really helps to reduce server load, conserve […]

Use WP functions outside of WordPress

Here’s how easy it use to use any of WordPress default functionality from any PHP file outside of the WordPress installation directory.

WordPress Cron Tips

Here are some quick tips for working with WordPress Cron. The trick to using the scheduling functions is to get the next scheduled cron using wp_next_scheduled().

Recursively display images via PHP

Here is an easy way to display all images in a directory — including images contained in sub-directories.

.htaccess for cookie-less image domain

Here is a choice collection of .htaccess directives that I use when hosting images on a subdomain. When doing so, it’s best for performance to make sure the domain or sub-domain is “cookie-less”, so there is no time wasted sending cookie data back and forth between the server and client. Other optimizations are included to […]

Get the Current URL in WordPress

Quick tip: get the current URL in WordPress:

Combine & compress CSS files with PHP

Here is another technique for combining multiple CSS stylesheets into a single, compressed file.

WordPress Allow HTML in Author Bio

By default, WordPress filters out any markup included in the description (bio) of user profiles. Here is a code snippet to allow HTML in author bios.

WordPress: Get category slug on archive views

When working with WordPress, you can get the current post category using the function get_the_category(). That’s great but it works only on single posts and pages. This post explains how to get the category for archive views like date archives, category archives, search results, and so forth.

.htaccess block spammer

Quick tutorial showing how to block a specific spammer via .htaccess. This technique is perfect for forum and site owners who want to block access to pesky visitors based on their reported IP address.

Advanced search for custom post types

Setting up custom search forms for custom post types can be tricky business. Here’s a quick & easy guide to make it happen in two steps.