WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 29 of 35

Static home page with separate posts page

In WordPress, static home page is possible via the General Settings. Or you can choose to display your blog posts. But how do have both?

Query String Parameter Redirect

Example snippet showing how to redirect from one URL to another, changing only a single parameter in the query string. It’s a subtle but a commonly used technique, especially in the SEO field, where URLs are changed frequently to optimize for structure, keywords, etc.

Deluxe Copyright Dates in WordPress

There are (at least) three ways to display copyright information (date and name) on your WordPress-powered web pages.

Disable default WordPress widgets

Delivering a clean custom theme involves removing components or features that will not be used. Here’s how to disable WordPress default widgets:

WordPress Random Post Class

Here is a simple plugin that you can use to include a random post class for each post. With a slight modification it can be used to include a random body class. This function can be useful for applying random colors and styles to your blog posts. Or whatever.

Disable iOS Tap Color

Here is a quick CSS snippet to disable the tap color in iOS.

Why aren’t permalinks working?

Here is a quick guide for troubleshooting why WordPress permalinks might not be working.

jQuery Toggle Password Field

Just a quick jQuery code snippet to toggle a password field. I used this technique for the license field of my premium WordPress firewall plugin, BBQ Pro. Sharing it here for reference and just in case I need to use it again.

Superbox replace rel with data-rel

At WP-Tao.com, I use jQuery Superbox to display lightbox-style popup images and screenshots. Here is a quick mod used to replace rel attributes with data-rel.

CSS Viewport Tricks

Note to self: you can specify various viewport properties such as initial-scale and user-zoom via <meta /> tags or directly via CSS.

WordPress Get Edited Post ID

Working on my plugin Disable Gutenberg, I needed a way to get the ID of an edited post. Not on the front-end, but on the “Edit Post” screen in the WP Admin Area. Unfortunately WordPress does not provide a built-in core function for handling this, so it’s necessary to roll our own solution.

Display the visitor’s Google search terms

A neat trick in your themes is to display the search terms used by the visitor somewhere on the page. Here’s how to do it for visitor’s arriving at your site after searching in Google.