Smokes your problems, coughs fresh air.

Aihato WordPress development notes

I’m collaborating with YTEC on a new website for Aihato. I’ve picked WordPress to do most of the heavy lifting for this project. So far, I’ve spent most of my time on this project to get a good development environment in working order, with WordPress living in its own directory and some deployment recipes managed from a Makefile.

Now that I’m well-settled in the YTEC office with everything set-up and running, I hope to make some actual progress on this project next time that I’m here. 😉


  1. Rowan Rodrik

    I’m trying to pick a contact form plugin. From this list, I’ve tried a few plugins so far:

    MM Forms seemed very nice, albeit a bit over-engineered. My needs are very simple. I just need to know the person’s name, email address, and of course a message. However, MM Forms still seemed worth the try. On installation, I noticed that I needed to mkdir exports; chmod 777 exports captcha/tmp. This, I don’t like. Still, I reactivated the plugin only to discover the following error message when visiting its options page:

    Warning: option_page(/var/www/ [function.option-page]: failed to open stream: No such file or directory in /var/www/ on line 579

    This is a bug which is caused by using ABSPATH . PLUGINDIR . '/mm-forms/includes/' to set the $includes dir in the main plugin file, which means that the plugin hasn’t been properly modified for WordPress 2.6, something that can go unnoticed unless when you rely on particular 2.6 features as I do for this project.

    In the end, I did fix the bug because the other simpler plugins which I tried proved a bit disappointing. The administrative functions of MM Forms are a bit buggy, but I could get the form to display by typing the shortcode directly (The TinyMCE button is one of the buggy parts).

  2. Rowan Rodrik

    For the guestbook import, I thought to be clever to take a simple plugin which imports comments from something else (Facebook) and adapt the facebook_new_comment() function. However, because I couldn’t get the Ruby scraper to work on the host where the PHP script had to run (although I could have installed PHP on my laptop and use an SSH tunnel to connect to MySQL on the dev. server), I decided to do a short XML-RPC hack in Ruby so I could run the import from my laptop.

    I haven’t often worked with XML-RPC, but it turned out to be much quicker and easier than my previous hack.

    I did have to add a WordPress plugin to allow anonymous comments through XML-RPC.

    For the rest, the following documentation proved useful:

  3. Rowan Rodrik

    So I got MM Forms to send me a mail, but the user doesn’t get a notification or anything. The user is simply greeted by an empty form. Not cool, not clear. On top of that the administration page is just too sucky. Exit MM Forms.

  4. Rowan Rodrik

    WP Contact Form is another plugin I tried. Today, when reopening its options page for the first time since upgrading WordPress to 3.0, I was greeted by the same problem as the MM Forms include bug I mentioned earlier, except this time it wasn’t caused by a bug in the plugin but by a WP bug that I think was introduced in 3.0 by the merge with WPMU.

    So, I’ve temporarily patched the WordPress code and I’m back at WP Contact Form’s option screen, which is much cleaner and a lot less over-engineered for my purpose than MM Forms. Only problem is that I can’t customize the form’s HTML and I’m too lazy to adjust the designer’s CSS to this different HTML.

    At the very least I want the field labels to be in Dutch, so I’ll just fork the code so that I don’t even have to do a translation file. Lazyness is bliss. 😎

  5. Rowan Rodrik

    I hacked the WP Contact Form code to serve my purposes a bit better. In the end, I did do some CSS changes, because it seemed to be less work. Also, I did create a translation file after mucking around quite a while before I found out how to name the .mo file. Apparently, the correct name for this domain is (My WP_LANG is also set to nl, not nl_NL.)

  6. Rowan Rodrik

    I’m trying to figure out how to do a gallery for this website project… So far, not much luck. I’ve tried nextgen-gallery, but it’s too extended and too limited at the same time. It adds a three tables to the database, and a whole new menu to the back-end. It seems pretty advanced, but it failed my very first uploading test, when I tried uploading filenames with spaces whereas WordPress’ own image/gallery attachment feature doesn’t make a problem of this (it simply substitutes the spaces with dashes).

    Ideally, what I want is this: some custom post type that allows me to add a gallery without requiring me to add a regular post to encapsulate it. On the other hand, everyone likes a little context. What I do absolutely require, however, is a gallery view where I can view just the images and the videos that are attached to the posts and nothing more. I need these to be organized into “albums”.

    Also, I want all regular links to images (in the news archive, etc.) to become Lightbox-like in their behavior.

  7. Rowan Rodrik

    One of the first things that I added in May (svn log says it started working on May 28) was an event management interface for the back-end. This interface is meant to easily manage a table of the events that are important to Aihato, such as kickboxing galas and kung fu demonstrations. Also, it manages an additonal table which contains a list of participants per event and their results (whether they win or loose, etc.).

    I did this as a good old WordPress plugin, with my own. ugly administration screens and SQL CRUD. My codebase has gone back and forth from WordPress 2.9.* to wp-trunk a few times until 3.0 got released on June 17 and I could finally use exciting new features such as Custom Post Types. (The reason I went back to 2.9.* a few times was because of the (still) incomplete NL gettext messages for 3.0.) Now that I’m on 3.0, I wonder if I couldn’t have done this functionality better with custom post types and, if so, how.

    Anyway, here’s a few good resources on this new WP feature:

    One place where I’m sure that the custom post types will make a difference is in the fighter profiles. Now, the backend user has to select a parent page, a custom template, and at least four or five custom fields which are necessary for the template. The parent page is necessary to identify the “type” of the page in places where I want to get a list.

    The problem is: how do I convert my existing page content to a custom post type? Could I just change the post_type field in the database after adding the necessary function calls to register this new type?

  8. Rowan Rodrik

    While researching how to reattach images from the WordPress media management panel, I came across this support topic. I also found an interesting plugin which allows the reattachment of images to other posts. Another interesting feature of the plugin is being able to tag individual images, something I’ve been wanting to be able to do for this project.

    Not that I needed any of this to solve the problem at hand. I noticed that WordPress already allows me to attach unattached images. I just had to permanently delete the deleted post to which they were attached. (Someone had created an empty post (actually three) with the images instead of uploading them to the existing post to which they naturally belonged.)

  9. Rowan Rodrik

    Today, I had to fix a bug (or extend a feature) related to displaying a fighter’s Fight Record. Normally, the fight record is a custom field with the stats formatted as (a combination of) the following examples:

    1 winst ; 2 verlies ; 2 onbeslist
    1 winst
    2 verlies
    2 onbeslist
    3 winst (1 KO) / 2 verlies / 2 onbeslist

    However, there’s one fighter who has a fight record for MMA as well as Taiboxing:

    MMA : 2 winst ; 1 onbeslist ; 1 diskwalificatie
    Taiboxing : 1 winst ; 1 verlies

    This wasn’t supported by the code which parsed the field. Modifying this and debugging the modifications took me quite some time. All this time I was reminded how great it is to be able to type “make update-development” until I was satisfied enough to “make backup-production && make deploy-production”. I’m able to do this very easily because I have a development version of the website running on the same server as the production version. Seperating these environments is easy and the Makefile that I did for this project makes it easier still. I just love how non-generic this Makefile is. It’s adjusted very neatly to all the advantages of having production and development on the same server.

    Anyway, this was just a comment to comment on how much nicer it is to work on a website when the whole production/development cycle is well taken care off and reliably set-up. 😀

  10. Wordpress Development

    Great Information Mate, Nice tutorial.

© 2024 BigSmoke

Theme by Anders NorenUp ↑