Tag archive for "wordpress-theme"

Import WXR files from server or on plugin activation

I recently patched the WordPress reset plugin to make it possible to reactivate multiple plugins after the reset. Until sivel releases an update you can download the patched version from my server (Edit: ancient content removed). As I frequently need to wipe WordPress installs during development I was looking for ... more

Set static front page and blog page programmatically in WordPress

You want to make sure the About and Blog pages exist, so create them before if necessary, see wp_insert_post() more

Custom WordPress SQL query for multiple meta values

To check for multiple custom fields you have to join the meta table twice. more

Run code when a new blog is created

Run some code when a new blog is created. I'm not sure, but I guess this code has to be in a network-activated or mu-plugins plugin. Maybe having this code enabled in the blog you're using will suffice. more

Custom taxonomy with meta data

This snippet shows how you can add metadata to your existing custom taxonomy. So you can use update_metadata() and get_metadata() on your taxonomy. The filter on switch_blog is only necessary if the code runs on a blog network (recommended to implement anyway). The name of the database table is very ... more

Order posts in a $wp_query manually

Build a custom WordPress query and order the posts however you want them. Notice that this won't work properly if you page results, so it is only useful in very specific cases. Btw, wrap everything into your class and get rid o the global var when you use this ;-) more

How to minify WordPress theme stylesheets properly

If you build WordPress theme you'll eventually come to the point where you want to minify the stylesheets. But the WordPress theming system has a fundamental flaw: It expects theme headers like name, version information etc. to be in the style.css. This is bad because removing the headers from the ... more

Get a category name/slug/id for a post or archive page

There's obviously a little context missing for this paste, but the basic idea should be clear ;-) more

Simple upload field for WordPress plugins/themes

With this you can upload images through your plugin/theme. They are saved as attachments. Please add nonce fields for security reasons. more

Better Lorem Ipsum Generator for WordPress

When you create WordPress plugins and themes it is often a good thing to test them on blogs with much data. Since 3.0 I use custom post types and custom taxonomies a lot and couldn't find a plugin that autogenerates them. Hence I wrote a new plugin. Features: Automatically create ... more