Software Developer. Computer Geek. INTJ.

Month January 2011

Get the domain name from a URL for display purposes in PHP

This is a very simple function to convert a user-supplied URL to just the domain name.

Automatically enable plugins in new WordPress Multisite blogs

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

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…

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.

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.

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.

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.

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.

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.

Set default theme for new WordPress Multisite blogs

Even if you disable all but one theme, WordPress seems to default to TwentyTen when creating a new Multisite blog. The fix is simple though – add this to wp-config.php.

Prevent WordPress sending any emails

I did this simple hack on a private WordPress Multisite blog, to stop it sending me emails every time I created a new blog. It’s definitely overkill to stop all emails, but unfortunately I couldn’t find any hooks that let…

Winter Onederland

Christmas & New Year 2010/11

© 2021 Dave James Miller — Powered by WordPress

Theme by Anders NorenUp ↑