Category Archives: Code

WordPress development with wp-config.php

I use the following setup for testing code against multiple versions of WordPress. These instructions assume that you’ve already created the setup for MAMP development across computers via Dropbox.

Continue reading

Hello, web site

The goal: a nicer-looking web site.

The rules:

  1. No S/FTP uploads to the server. You can use the Media Library upload for allowed file types only.
  2. No custom themes or plugins. You can install themes and plugins directly from the WordPress.org repository, but not via Upload Plugin or Upload Theme.
  3. No file editing. You can use the Custom CSS module from Jetpack, but not the theme or plugin editor.
  4. No outside programs. You can only use your browser (and any useful sites you visit) for image editing.

MAMP development across computers via Dropbox

I use the following MAMP PRO setup for testing and development. It lets me sync data and host information across my computers, so that I have access to my local setup1 no matter where I’m working. This assumes some knowledge of basic UNIX commands, Terminal, and MAMP, and starts from scratch.

Continue reading

How To List A Custom Post Type’s Taxonomies And Terms

I’ve been using the new [Twenty-Ten](http://wordpress.org/extend/themes/twentyten) theme for WordPress on my personal website; it’s great out of the box, but I wanted to display my custom post types and taxonomies in the same format as it uses for categories and tags. The function is broken into two parts: `ucc_get_terms()` returns a multidimensional array of the post’s taxonomy name(s) and each taxonomy’s term links; `ucc_get_terms_list()` gets the taxonomy information and formats the array for display in the template.

Continue reading

Adding A Custom Taxonomy Terms Widget To WordPress

The WordPress Categories Widget currently only handles the `category` taxonomy. I’ve modified it to allow the user to select a taxonomy, and tied in the Tag Cloud Widget code to give the user the choice of display formats: list, dropdown, and cloud. Multiple instances are possible, providing the user with an easy method for displaying links to user-built taxonomy terms.

`preg_replace_callback()` is used to fix the JavaScript for the dropdown menu; instead of generating the default `?query_var=value` format, it uses `get_term_link()` to generate the term URL.

Continue reading

Adding Custom Post Types To get_calendar() And The Calendar Widget

By default or design, the WordPress function `get_calendar()`[^1] does not handle post types other than `post`. I’ve updated it as the standalone function `ucc_get_calendar()` to allow it to accept a `$post_types` array; the included filter function `ucc_get_calendar_filter()` will allow for seamless integration via `functions.php` without requiring additional editing of Theme templates. (Note that the filter will also apply to the Calendar Widget’s output.)

Continue reading

Adding Custom Post Types To wp_get_archives()

Again with the custom post type extensions. This function lets the native WordPress `wp_get_archives()` [^1] [^2] know about public custom post types; just add it to the `functions.php` of your theme. Of note: the builtin `link` post type can be included at the `array_merge()` point; I just had no use for it.

Continue reading