WP-Mix

A fresh mix of code snippets and tutorials

Popular Posts

All posts ordered by popularity

Page 31 of 34

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.

WordPress Trigger and Target Interim Login Screen

Our previous post on WordPress login parameters is very complete. Or so I thought. But I had forgotten about the “Interim Login Screen”. The interim login screen is displayed when you are working in the WP Admin Area and for some reason the session expires and you are logged out.

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.

WordPress s2member PayPal Fix

For those using s2Member and getting no response after clicking the “Continue” button on the PayPal.com site, here is a quick possible solution.

Notes on @media queries

Just a couple of notes for working with CSS @media queries: two ways to write media queries and how to query portrait vs. landscape orientation.

jQuery Fade Out Element

Here is a simple jQuery technique to fade out any element on the page. It uses jQuery’s .hide() method to animate the fade-out of the specified element.

HTML5 Starter Template

Ahh yeah, HTML starter templates at your service..

WordPress plugin redirect when settings saved

This technique is a bit esoteric and mostly for my own reference. Feel free to try the code if it makes sense to you; otherwise, maybe just move on to the next code snippet. Just not enough time in the day to explain everything.

PHP: Remove Empty File Data

This quick function does one simple thing. It removes empty file data from a PHP files array. As you may know, the structure of the $_FILES array is sort of backwards from what normally would be expected. Because of this, removing empty file data from the array requires some extra wrangling. So to make things […]

Filter pre tags in bbPress

A couple of functions used at htaccessbook.com to enable unescaped/unencoded pre and code tags in bbPress forum posts.

Get WP, PHP, and SQL Info

Here are some sweet code snippets for getting various types of server information. Includes more functions for getting and/or checking various types of WordPress, PHP, and SQL data. Strictly plug-&-play for quick reference and copy/paste usage.