WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 5 of 34

CSS select all except last child

Blazing fast snippet for you today: how to select all children except the last child. Targeting HTML with CSS has never been so much fun..

Chrome Extension Icons Missing from Toolbar

I recently upgraded Google Chrome browser to version 52 point something or other, and noticed that all of my extension icons suddenly were missing from the Toolbar. Apparently Google decided to “hide” them all in the Chrome settings menu.

PHP Compress CSS & JavaScript

Quick snippets for compressing CSS and JavaScript with PHP’s ob_gzhandler, which will gzip or deflate content depending on browser support.

Display all images attached to post

Another technique for working with WordPress attachments, here’s how to display all images that are attached to the post, either before or after the existing post content.

Combine Audio and Video in QuickTime 7

Quick tutorial showing how to combine audio and video in QuickTime 7 on Mac.

Block XSS with .htaccess

Quick snippet today that you can add to your .htaccess file to block some common XSS (cross-site scripting) attacks.

Get child or parent theme URI & path

These days, WordPress provides numerous ways to get the path and URI for the current theme directory. This post is reference for WP developers who need to get the URI and/or path for the current child or parent theme. Just grab, gulp, and go..

WordPress Exclude Custom Post Type from Search

Out of the box, WordPress search results include matches from any Custom Post Types that may be enabled via the theme template. For example, at htaccessbook.com, any matching content found in forum posts will be included in search results. This default behavior can be super convenient, but it is not always desirable. In this quick […]

Add Defer and Async to WordPress Enqueued Scripts

When adding JavaScript in WordPress, it sometimes is necessary to add attributes such as async and defer to the <script></script> tag. Here is a technique to do it with any WordPress version 4.1 and better.

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.

Canonical www via .htaccess

Creating canonical URLs for your site is an important part of good SEO. In this quick post, we’ll look at several .htaccess techniques for removing and requiring the www prefix, and additionally we’ll see how to remove any index.php appendage from all URIs.

Including Arrays in URI Requests

Some esoteric code phenomena for you today.. in this post I explain how PHP handles arrays when they are included in URL requests (via the query string). It’s something I failed to grasp until doing some in-depth work developing my professional WordPress firewall plugin. Now let’s jump in..