December 21, 2006

PostCat2LinkCat Plugin for WordPress

Filed under: Blog, Projects, WordPress Plugins — mbeihoffer @ 7:45 pm

I just finished writing my first WordPress plugin, which was quite educational.

You can get the php file here - sorry I didn’t zip it or tarball it up. Maybe version 0.3 will come with zippyness.

It works with WordPress 2.05, but probably won’t work when 2.1 comes out, due to the major database changes they’re rolling out (primarily, they are merging the two tables wp_categories and wp_linkcategories, so wp_linkcategories won’t be around for much longer.)

I wrote this plugin because, aside from writing a custom Category template for each WordPress Post category, there was no simple way to associate a link category with a Post Category. Basically, what I wanted to do was to associate certain link collections with certain Post categories, so if you’re browsing the Design Category, it might show you links from the CSS and Color Theory link category.

What’s nice about it is that it enables you to associate multiple link cats with specific Post cats, so you can have an assortment of links randomly appear in the sidebar (or wherever you want, I guess.)

The plugin does add a database table to your WordPress database called wp_postcat2linkcat, which is where it stores the associations, and it also adds a screen under your Admin->Manage page so you can choose which categories go with each other. I tried to code the plugin as closely to the WordPress Plugin API pages and tutorials as possible, but this plugin does come with no real warranty, so use it at your own risk. ;-)
I’m not too disappointed that WordPress 2.1 is going to make this plugin obsolete - I just joined the Testers group so I’ll be beta testing 2.1 myself. Maybe I can adapt the plugin and make it a little bit more sophisticated - right now I’m only using it on an old test site of mine, but I’m sure in a week or two I’ll want more features.

Installation: Download the file. Stick it in your “plugins” directory. Activate.

Usage: Find the template file where you want the links to appear - I recommend the sidebar.php file, although you could put them anywhere really. I avoided using any Template Tags that required being in the Loop to work, so you’re not limited to using the pc2lc_get_links() function in any specific area.

Simplified usage: After installing the plugin, just go to Manage->Post2Link Categories and assign some link categories to your Post categories. Then, just edit your sidebar.php file and insert the line
where you want the links to appear.

More complex usage: You can specify the following parameters (exactly similar to the parameters that are available with the get_links() function)

‘between’, show_images, ‘order’,
show_description,show_rating, limit,
show_updated, echo); ?>

This is obviously a lot more effort, but on the other hand, you get a lot of control over how the links will be generated and formatted.

I’ll try and document it more later - time for a break.

December 4, 2006

SimplePie Plugin

Filed under: Blog, Projects, WordPress Plugins — mbeihoffer @ 4:18 am

I’ve been working with the SimplePie WordPress plugin today on some of the sites we maintain, and also have been dabbling with a few other WordPress plugins.

The SimplePie plugin is designed to make it easy to include RSS syndicated content on a WordPress site. It handles RSS and ATOM feeds fairly well. I had some major trouble getting it to work on the False Claims Act web site, where I was using it to pull content from Bob’s blog and also from Bob’s main site feed.

The troubles I had, which I finally resolved, stemmed from the fact that since the FCA site is hosted on HostingAve’s servers, and because Tom Kleinschmit had at one point set up DNS records for http://www.rpcmnlaw.com, the server was looking in the wrong place for Bob’s web site, instead of over at Pair’s server which is where Bob’s site is actually hosted.

I was able to fix it by logging into HostingAve’s server and changing the DNS records, which solved the problem - it took me a lot longer to troubleshoot and fix than I’d like to admit.

While I was at it, I went ahead and upgraded Bob’s blog to Wordpress 2.05. It was fairly easy. I also re-enabled comments on his site, and turned on Akismet to help handle the crushing load of the ~600 or so spam comments he’s accumulated on the site so far. I went through and deleted all the spam. I also got RSS syndication working between his blog site, his main site, and the False Claims site, so now headlines from the three sites appear at various places around each other’s sites. I don’t know if that was wise, but it’s pretty cool that when you look at Bob’s profile page on the False Claims site, you see links to his latest blog posts and also any new content published to Drupal.
I also have been using the Smart Ping module with WordPress, on Bob’s site where it is now installed, on the False Claims site, and also on the Dragonfly Networks Beta site. It handles the whole XML-RPC Ping-o-matic thing a little better than the default WordPress ping engine, and logs the various transactions as well, so you know if it’s working better.

There is also the WordPress Head Meta Description plugin, which creates meta tags automatically for you based on the page’s content in WordPress; hopefully, this will help drive some traffic to the sites. I’m not sure if any search engines really trust Meta tags anymore, but it can’t hurt, right?

LAPTOP NEWS UPDATE

Well, it took just about forever, but I finally got a semi-decent working installation of Linux on my laptop. It’s still got some issues, but I’m happily running Debian Etch right now, and most things are working well. I had numerous problems with my ThinkPad’s networking card, which totally sucked up at least a half a day’s worth of troubleshooting and testing, but it’s working all right now and I wrote some shell scripts to help manage the transitions between the various wireless networks I use.

I spent a goodly amount of time learning whole bunches about Linux networking, in the process, so that’s helpful.

Also, here is my xorg.conf file.

It doesn’t do anything special yet, but it works with my Logitech USB wheel mouse and ThinkPad touchpad.
I am still having some slight problems with my wireless card; sometimes after rebooting the card will not see the wireless network, no matter how many times I try and set the iwconfig configuration settings by hand, it simply just doesn’t see anything until I reboot (again.) I’m going to try and spend some time on it this week, as I believe there are some other alternate wireless drivers I can use with the card, but until then, I’ll be hobbling along like Jenni, except with less fashion sense.

(Speaking of Jenni, she just poked her head in to tell me to come to bed, so I’d better wrap this up.)

FALSE CLAIMS ACT ARTICLE

I spent part of my morning writing an article for the Attorneys Against Government Fraud. There was a very lengthy and interesting New York Times article about an auditor at the Department of the Interior who has filed a lawsuit against an oil company under the False Claims Act. I came across the article via a summary analysis on Daily Kos and thought it beared further investigation.

The attorney group really needs some more content if they expect that site to fly. They’re currently just running on fumes, and there is only so much we can do with changing the layout, adding photos, etc, to improve the site’s ability to attract attention. However, I feel that the new layout may inspire them to contribute more content, at least to some degree.

In the meantime, I’m going to post various articles of interest to the site and try and sustain the momentum.