WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 15 of 35

Simple live comment preview with jQuery

Here is a very simple and basic live-preview for comments and contact forms.

Cron Notes: Ping External URL with No Output

Working on setting up Cron on ASO server for testing purposes.. just want to ping a URL/file, not save or send any output whatsoever. Here are my notes for future reference.

Simple Ajax Chat: Auto-Clear Chats

This tutorial explains how to hook up automatic clearing of chat messages with my WordPress plugin, Simple Ajax Chat. Note that this tutorial is for the free version of SAC.

Apache Request Method Types

Here is a list of all types of Apache Request methods. GET PUT POST DELETE CONNECT OPTIONS TRACE PATCH PROPFIND PROPPATCH MKCOL COPY MOVE LOCK UNLOCK VERSION_CONTROL CHECKOUT UNCHECKOUT CHECKIN UPDATE LABEL REPORT MKWORKSPACE MKACTIVITY BASELINE_CONTROL MERGE INVALID If you know of any others, let me know — thanks! :)

jQuery browser detection

Here’s a tasty little snippet for adding custom browser classes using jQuery.

CSS Multiple Media Queries

@media queries are instrumental in creating responsive CSS designs. This tutorial explains how to combine multiple media queries to keep things optimized.

Another WordPress Cron Example

Here is another WP Cron example for my previous article on WP Cron tips.

WordPress db-error.php drop-in template

One of the more useful WordPress must-use plugins and drop-ins is the db-error.php file, which you can create, customize, and upload to your site’s /wp-content/ directory. Upon doing so, the contents of the file will be displayed whenever the database is unavailable. This post provides a simple template for db-error.php that you can customize and […]

Publish a post via functions.php

Normally users create new posts from the Posts Edit screen in the WordPress Admin, but you can also publish posts from the functions.php file.

jQuery Add / Remove Class

Adding and removing classes to/from HTML elements is super-easy with jQuery. Here is a quick tutorial that explains how it’s done. The code snippets are copy & paste friendly, so you can grab, gulp, and go.

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.

WordPress pre_get_posts example

Here is a quick example showing how to modify the main WP Query (Loop) using the pre_get_posts filter hook.