Dave James Miller

Developer. Computer Geek. INTJ.



The WordPress Template Hierarchy


WordPress Themes by Anders Norén


I really like Baskerville (which I’m currently using for this blog) and Lingonberry.

Read More

WordPress Plugins

These are WordPress plugins I use and recommend… Read More

CryptoPHP backdoor in pirated CMS themes & plugins


A backdoor that has been dubbed “CryptoPHP” was found hidden in pirated (“nulled”) themes and plugin…

Read More

Display a list of a user’s Gists in WordPress

This code creates a shortcode, [gists], which displays a list of all Gists by a user, grouped into categories then listed alphabetically. Read More

Replace URLs in the WordPress database when moving between servers

Run this to replace URLs in the database when moving a WordPress blog from one URL to another. Read More

Script to download MySQL database & files from live to development server

This is a script I use on a lot of sites to copy the database (MySQL) and any uploaded files to the development site, and modify the database as required. Read More

Split WordPress theme functions.php into multiple files and autoload them

I use this to split my theme’s functions.php into multiple smaller files on particularly complex sites, and to autoload those files (instead of having to manually require each one). Read More

Using Gravity Forms with WP-Types custom date fields

This is a filter to take Gravity Forms format dates (dd/mm/yyyy) and convert them to WP-Types format dates (integer). Read More

Sort and filter WordPress posts query by a custom field

In this example the event start & end dates are entered as timestamps using WP-Types. It could also be modified for Advanced Custom Fields which uses strings. Read More

Keyboard shortcuts to indent/outdent and format as code in WordPress TinyMCE

This allows you to indent lists/paragraphs in the TinyMCE WYSIWYG editor using Tab, and outdent using Shift+Tab. I wrote it because I write a lot of nested lists, it’s tedious using the keyboard to indent and outdent, and I couldn’t find any… Read More

Insert a post into WordPress from an external script

With wp_insert_post() and wp_set_post_terms()... Read More

Display WordPress admin area dates in UK English (en_GB) format (day-month-year)

While entering several back-dated posts into a WordPress blog, I got annoyed at the date fields being in American month-day-year format and decided to fix it. Read More

Store WordPress post password cookies for the browser session only (instead of 10 days)

WordPress saves post password cookies for 10 days, and there is no setting or filter to change that, but you can use this code to replace the form action entirely. Read More

Hide the permalink and Edit button on the WordPress Edit Post admin page

This hides the permalink and edit button on the Edit Post page in WordPress. It is useful for when permalinks are not editable (e.g. if it uses the post ID only) in that case its really just taking up screen… Read More

Hide the title box on the Edit Post page in the WordPress admin

This hides the title textbox in the Edit Post page in WordPress. It is possibly useful when using a theme like P2 that doesn’t actually display the title, so you don’t want to be going to the trouble of writing one. Read More

Set WordPress site URL in the config file instead of the database

WordPress stores the site URL in the database by default (which I have never understood), and its a pain to have to type out the UPDATE SQL or search in phpMyAdmin to change it. This is a simple way to… Read More

Automatically enable plugins in new WordPress Multisite blogs

There are three options (that I know of) for automatically enabling a plugin in new sites. Read More

Automatically generate subdomain for new WordPress Multisite blogs

When you create a new WordPress Multisite blog from the admin area, you have to enter three things: Site address (subdomain or folder name), Site title and Admin email... Read More

Set site/plugin options for all blogs in a WordPress Multisite network

I used this code snippet as part of a WordPress Multisite plugin, to allow me to quickly set some options for all blogs in the network. Read More

List of all blogs in a WordPress Multisite network

This code was used to generate a menu showing all blogs on a WordPress Multisite installation. Read More

Alternative to the_category() in WordPress that works correctly with nested categories

The WordPress function the_category() doesnt work particularly well when you have hierarchical categories. Read More

Set default category / tags for a new WordPress post using links

I used this code to automatically set the default post title, category and tags for a new WordPress post based on which link was clicked. Read More

Force additional categories to be added to a WordPress post on save

On one WordPress blog I have categories for "Starred" and "Archived", in addition to the real categories. I hacked this together to make sure the posts would still go into Uncategorised as well. Read More

Toggle category with ajax in WordPress theme (frontend)

This is a follow-up to Toggle “Starred” Category in WordPress – making it more generic and usable for multiple categories. Read More

Page 1 of 212

© 2017 Dave James Miller — Powered by WordPress

Theme by Anders NorenUp ↑