WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 29 of 36

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.

Increase upload limits for WordPress

If you’re encountering restrictive upload limits in WordPress, here is a simple fix:

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.

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?

FeedBurner .htaccess redirect

Need to redirect your feeds to FeedBurner? Here’s how to do it with a thin slice of .htaccess.

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.

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 […]

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 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:

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.

Display performance stats in WordPress

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