WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 29 of 36

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?

Update WP plugins via Mac Terminal

Here’s a quick guide for updating your WordPress plugins in the Plugin Directory using Mac Terminal.

Display a custom gravatar in WordPress

Using your own custom gravatars (aka avatars) in WordPress is a piece of cake.

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.

CSS Vertical Center Block

Here are two ways to vertically center a block-level element using CSS. The first method uses CSS flexbox, while the second method uses CSS transform.

Display short URLs in WordPress

Quick tip for the day: display short URLs using native WordPress functionality.

Block Wayback Machine

If your website has been online for any length of time, it probably has been crawled and stored in the Internet Archive, AKA the Wayback Machine. That means your web pages will be available even if your site is taken offline. To remove any pages that already have been archived, you need to contact the […]

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.

Display performance stats in WordPress

Here is how to display the page-generation time based on PHP and MySQL.

Convert NEF to JPG

I take a lot of photos and recently started shooting in NEF format (because I bought a Nikon). I like the quality, but had a difficult time (on several occasions) trying to find a way to convert the NEF files to JPG or PNG.

PHP Geo IP Lookup

Here is a nice PHP snippet for GeoIP lookups. As written the script uses api.hostip.info for the lookup service, but that is easily changed as needed (GeoIP lookup services change or go offline constantly). So for what it’s worth, figured it was worth sharing rather than complete and utter deletion. Yes I am a code […]