WordPress Plugins and Hacks

UPDATED 07/24/04 18:02 JST
Super Geeky entry on Blog migrations… you can safely skip if you do not have any idea what the names “WordPress” and “Movable Type” stand for. [I also added 100% WP stuff down there]

A temporary entry on the work in progress that is my move from Movable Type to WordPress.

I ported a bunch of scripts and plugins I was previously using with my MT installation. Also hacked happily through WP’s PHP sources…

Not completely done, but here are already a few usable hacks (I would not quite call them “plugins” given the amount of tweaking required to use them):

  1. mt2wp: Redirecting old MT entries to WP entries

    This script will not only redirect your old Movable Type archives (both categories and monthly), it will also redirect direct entry permalinks (e.g. “000123.html#000123”).
    To do the latter, you will need to have your old ‘mt_entries’ table in the same database as your current WP tables (you do not need the full MT install, just this table), but you can still have archive redirection by date and category even if you have thrown out your MT tables.

    Please read the instructions for more details on how to install and use.

    Overall, don’t forget to:

    1. Edit the script (mt2wp.php) with your blog archive’s URL
    2. Upload the script to your WP directory
    3. Edit your index.php template file
    4. Edit your .htaccess file
    5. Optionally edit your css file (usually wp-layout.css)

    SourcesZip File

  2. Picture Glue: Image Posting Plugin

    A port of the small plugin I had written for MT. By far not the most advanced picture import plugin for WP: there are better and nicer plugins out there doing roughly the same. But I needed backward compatibility and after all, it’s a convenient lightweight plugin to seamlessly upload and insert pictures in an entry.

    Picture Glue automatically looks in a predefined location for folders containing pictures (presumably uploaded through FTP), generates thumbnails and insert HTML code (with css tags) at the top of appropriate postings. Each picture folder must contain the ID of the post it is to be inserted into and must be writable by anybody (for thumbnail generation). This plugin updates the entry content in the DB once and for all, instead of dynamically filtering, thus creating less runtime overhead.

    To use, upload the php file in your plugin folder (located in WP wp-content directory). Read the plugin instruction for details.

    SourcesZip File

  3. Updated! wp-Filterz: Dynamic meta-filtering of your main content

    This plugin lets you define a bunch of meta-filters controlled by checkboxes. Checking/Unchecking boxes will show/hide entries dynamically. You can try it by going to the left bar of this site and playing with the boxes under the “Filterz” section.

    Now supports both IE and Mozilla-like browsers.

    To use it:

    • drop the plugin file into your plugin folder (located in WP wp-content directory)
    • edit the sample preferences with your own categories (you will need to know the ID of the categories you want to filter by)
    • upload the pref file to the wp-content directory (*not* the plugin directory)
    • edit your index.php file to include <?=filterz_class()?> inside the class declaration of your entry divs. Your template should look something like this: <div class="storycontent<?=filterz_class()?>">
    • use <?=$filterz_html_code?> in your template to output wp-filterz’ checkbox list
    • BTW: make sure you activate the plugin in WP’s admin tools.

    Plugin SourcePrefs file sampleZip File

  4. wp-Mood-Quote: Random quote matching your mood (codeveloped with Masquerade)

    This plugin lets you define a list of quotes/taglines/sentences to be displayed randomly when people load your page… with a small extra feature over the countless other random quote generator: this one will let you assign a “mood” to each quote and will then try to match the random quote with the current mood of your blog (using the last “mood” tag you set in one of your post). See docs for more details. (docs wiped out from Masquerade’s server, following some infortunate adventures in shell scripting involving the use of ‘rm -f *’ and no backup whatsoever).

    Zip FileTar Gz File

  5. New! Getting the “updated links” feature to work

    Not a hack. Just a little bit of help to those who might be confused on how to get that sort-by-last-updated feature to work in WP.

    Supposedly, WP lets you sort links. But simply following the instructions and calling get_links() with the proper parameters won’t suffice to enable that feature. To enable it, you must also:

    1. include (before calling any link output function) the file links-update-xml.php as such: include_once(ABSPATH.WPINC.'/links-update-xml.php');
    2. if you have upgraded (and still possibly if you have not), you must make sure you have a file named links-update-cache.xml in your wp-content folder and that it is writable by the server (chmod 666). caveat: it looks like previous versions of WP used a slightly different file name (link-update-cache.xml: mind the missing ‘s’), make sure you have the correct filename.

    Of course, you must also set the parameters in your function call correctly, as well as the options in WP-admin option panel.
    As an example, here is the code I use to output the bookmarks section on this site (it uses a list of IDs for the groups of links I want to display there). Feel free to adapt to your needs and reuse:

    <?php
    include_once(ABSPATH.WPINC.'/links-update-xml.php');
    foreach (array(2,3,5,9,7,8) as $this_cat)
    {
    echo "<li>", get_linkcatname($this_cat), "<ul>";
    get_links($this_cat, '<li>', '</li>', '<br>', false, '_updated', false, false, -1, 1);
    echo "</ul></li>";
    }
    ?>

  6. More will be coming… including:

    • a patch for MooKitty’s show_category plugin to generate a side blog from a specific category (the patch adds date synchronization between the main entries being displayed and the sideblog). it’s already being used on this very blog, I just need to clean it up and write a blurb for it.
    • small snippets that display smart navigational bars at top and bottom of the page… need to put these in a plugin and will release.
    • a patch on wp-mail plugin (allows posting of pictures through email) to use my Picture Glue plugin and generates thumbnails automatically (doesn’t do it at the moment). Actually, I made a whole plugin to do that (and more), it’s there: Keitai Mail Plugin
    • probably other stuff as I come across it…
Filed under: WordPress

17 comments

  1. Pingback: Dr Dave's Blog
  2. I think your sidebar is awesome. I have been looking for something like that for my webpage. I am currently using a javascript menu to navigate and I would really like to get away from that. I think your slide style would be exactly what I am looking for. If you are willing to give insight into how you coded that I would love to learn.

    Thanks
    Aaron

  3. Dear Dr Dave,
    I’m a C hacker, and while trying to setup my Scooter Club website, I decided to try to use your sweet little Picture Glue system. Since my hosting company only has PHP 4.1.6 with some weird support. I hacked Picture Glue so it switched to some older style code if it’s eariler than 4.2, so I could use it.
    Please check it out ( at http://www.negativeimagesc.org/wp-content/plugins/picture_glue.php.txt ), and include the changes in the offical version if you like them. e-mail if you read this.

  4. Dr Dave,

    I’m using the Picture Glue plugin, and I was just wondering how I would change the size of the thumbnails to something a little smaller. It’s been a while since I’ve looked at any PHP and while I’ve manged to hack a few bits of my own in there (including a teeny credit to yourself on every instance) I’ve not yet figured out how to reduce the size of the thumbs. Any advice for me?

  5. I’m looking for the DYMK? plugin info. Specifically, I installed it quite sometime ago and now I’d like to add an IP address to it. Do I just add it to dymk_prefs.php file after the already-existing one? Sorry, but I didn’t know where else to ask this.

  6. I’m a little confused about wp-Mood-Quote, could you please give me a example of it up and running so I can see how it shold function. Thanks Ed

  7. Hi. Can you tell me if Image Glue works with wp 1.5.3? I don’t seem to be getting anywhere with it (this is a locally installed sandbox system, on my mac). Although the last time through it DID create a thumbnail folder – which is empty?

    I was trying with a JPEG sized 600 px wide.

  8. Sorry – follow up. I see the code outs a mx size of 500 px on the image (although it STILL created the thumbnail folder?) Originally I had tried it with a 400px wide PNG…

  9. I am having the same problem as Andy with wp 1.5.3. The plugin creates an empty thumbnail folder, but that’s about it. No picture in the entry and nothing else seems to happen. I did chmod everything properly and adjust the php file to point to the right areas.

    Any idea whats up?

  10. Jesse
    I only managed to get this working when I had more than one image. With just a single image it failed every time. At least that’s how I remember it. I abandoned it actually because of that. Sorry…
    Andy

  11. Your link for the Mood Quote is broken.. Someone wrote you about that a year ago and still no fix..

Comments are closed.