Handling One Radio Button With JavaScript

Today, I discovered an issue that I have probably encountered in the past; but it’s been so long I forgot about it. I had some JavaScript set up to select a radio button based on text input, and then update the text based on the selected radio button (it’s a TinyMCE plugin that inserts a shortcode into the WordPress visual editor). Throughout all of the testing I performed, everything worked just fine. Today, though, someone else was testing the interface and could not get the text or the radio button to update properly.

After a bit of testing and messing around with the interface, I finally discovered that my JavaScript wasn’t recognizing the existence of the radio button on the form. After a bit more testing, I realized that’s because only one radio button existed; and JavaScript doesn’t treat radio buttons as arrays when there’s only one instance. When I had been testing before, I had multiple radio buttons, so everything worked; but now there was only one button, so it fell over.

Setting up WordPress MU Domain Mapping on GoDaddy

I recently worked with a client to help move a GoDaddy “WebsiteTonight” website into WordPress. In the process, I recommended that she turn her existing WordPress website into a multisite installation, set up her second site as another site in that install, and then set up domain mapping to give each of the websites a separate domain name.

This setup allows her to login a single time, and be able to switch back and forth between the sites to perform edits. It also makes it simpler to manage plugins, update WordPress and keep the theme consistent between the two sites.

Some WordPress Gallery Features You Might Not Know About

The other day, I was playing around with the WordPress [

] shortcode, and came across the need to exclude an image that was attached to the page. The image I needed to exclude was kind of like a featured image, and I didn’t want it to appear again in the gallery itself. So, I searched for information about excluding images from the WordPress [

] shortcode, and came across the related WordPress Codex article.

While reading that article, I noticed a handful of features I’d never known about in that particular shortcode. After all, I always basically assumed that the options WordPress gives you when inserting a gallery were probably the only options that were available.

Google Launches Initial Google+ API

googleGoogle’s latest attempt at social networking, Google+, now has a new first-cut at a developer API. The Google+ Platform blog has info on the release of the new API.

Startup blogger Robert Scoble put together a list of some of the feedback on the new API – it seems the reaction is mixed. RSS creator Dave Winer says Google “doesn’t get it”. Why am I surprised that a company who has a VP, Bradley Horowitz, post on Twitter that he only cares about Twitter users with over 100,000 followers might not fully understand how to promote a new API to developers?

The Google Plus team notes that they are using the follow existing standards and best practices where they can:

  • Our API methods are RESTful HTTP requests which return JSON responses.
  • Our payload formats use standard syntax (e.g. PoCo for people info, ActivityStrea.ms for activities).
  • We use OAuth 2 for secure trusted access to user data.

The Google Plus API is located here if you want to start to play with it.

Please Stop Using cURL in WordPress Plugins

WordPress HTTP class usage

Unfortunately, I keep finding WordPress plugins that try to call cURL functions directly. Unfortunately, not only do these plugins fail to work if cURL isn’t installed, it throws a fatal PHP error in the process.

The problem with using cURL in WordPress plugins is that WordPress solved that problem more than 2 years ago by implementing the WP_Http class. WP_Http is a class included in the WordPress core that has multiple options. One of those options is cURL, but it gracefully reverts to other PHP functions if cURL isn’t available.

Basically, anything you can do with cURL can be done with the WP_Http class, and it will allow your plugin to be much more versatile and compatible with more server setups.

Adding an ICS Event File to Google Calendar

If you register for webinars, conferences, meetings, etc. on a somewhat regular basis, you are probably familiar with ICS files. An ICS file is an iCalendar file; and can contain a single event or an entire calendar feed. Online registrations and event notices tend to make use of these files quite a bit, because they offer a one-click method for people to add the events to their calendars.

If you’re using Outlook, Thunderbird, iCal or just about any other desktop calendar program, you simply download the file, open it and save the event to your calendar.

However, if you’re using Google Calendar, things get a little bit trickier. There’s no simple way to open the file and have Google Calendar take over from there. Instead, you basically have to understand how Google Calendar expects ICS files to be used (why the system uses this logic is kind of beyond me; but that’s the way things are). Google Calendar, for some reason, does not seem to expect people to use ICS files to add individual events regularly. Instead, it uses the logic that an ICS file should include a calendar “feed”, similar to a website’s RSS feed, that would contain a complete list of events.