WordPress Dev 101: Setting Activation/Deactivation options [updated]

October 3rd, 2010 2 comments


When you are writing a WordPress plugin, you are more than likely going to have some sort of settings involved. These options are stored in the wp_options (or wp_blog id_options for multi site users) table of your database. Most of today’s WordPress users aren’t privy to the fact that every plugin they install, probably has something within their database taking up space. Some of the sites I’ve seen have over 50 plugins installed that, at one point or another, were activated. That’s 50+ possible rows in the database of options that may not be needed anymore if the plugin developer didn’t remove the options from the database upon deactivation.

The goal of every plugin should be optimal user experience without affecting the overall performance of the users site. In order to provide this experience you should have a set of ‘default’ settings for your plugin. These option settings should be set upon activation. This provides users with immediate gratification, and who doesn’t like instant gratification? Likewise, if someone chooses to deactivate your plugin and delete it, you should no longer be leaving an imprint on their configuration.
Continue reading “WordPress Dev 101: Setting Activation/Deactivation options [updated]” »

Categories: WordPress Tags: , , ,

Using x.co with Twitter Tools in WordPress [updated: official plugin]

September 8th, 2010 No comments

I have made this an official plugin and you can visit the page for this plugin by visiting Twitter Tools – X.co URLs

So the other day GoDaddy.com released it’s new URL shortener x.co. They’ve also built in an API, so from that, we can now use the Twitter Tools WordPress plugin with the x.co URL Shortener. I’ve hacked together a file based off the Twitter Tools bit.ly plugin that works in conjunction with the main Twitter Tools plugin without any issues that I’ve noticed so far. For now you need to do the following:

  1. An account with x.co (which is the same as a GoDaddy.com account or using the steps listed below in the update)
  2. Install Twitter Tools for WordPress
  3. Download this .zip file and extract it into wp-content/plugins/
  4. Activate the Twitter Tools – x.co URLs plugin from your plugins list
  5. Login to your x.co account and click on the ‘Settings’ tab, copy down your API Key.
  6. From the ‘Settings’ menu select ‘Twitter Tools’ and you will need to enter your X.co API Key.
  7. That’s it, you are ready to tweet your posts with x.co shortened URLs!

If you have any feedback let me know and I’d be glad to see what I can do to help you out. I will try and get this up on WordPress.org within the next day or two for installation directly in your WordPress admin area.


Update:
You do not need a GoDaddy Account to use x.co. You can use the following steps:

To sign up for X.CO
  1. Go to X.CO.
  2. If you have a Go Daddy account, log in with your user name and password.
  3. If you don’t have a Go Daddy account, on the bottom-left of the screen, click Sign Up for a Free Account.
  4. In the To Create a New Account form, enter your information and create a password.
  5. When finished, click Create a New Account.

New Plugin: Better AdSense Targeting

September 6th, 2010 No comments

Today I’m releasing the initial version of a new plugin called ‘Better AdSense Targeting’. If you have ever noticed AdSense ads that come up for things totally unrelated to your content? Yeah, that happened to me too. A little secret is that Google has some comments you can put in your site to either use or ignore sections of your page when determine what ads to display. This plugin takes all the work out of that for you and allows you to choose which sections to use.

Check it out at the Better AdSense Targeting page. Let me know what you think in the comments.

Categories: Updates Tags: , ,

WordPress Dev 101: Hooks

August 30th, 2010 No comments


When I first got into WordPress development, I had no idea how the Core of WordPress was designed. I knew that I wanted my snippet of code to fire at a specific time, but short of hacking it into the theme I was using at the time, I had no clue how to achieve this. It was then that I discovered the Hooks of WordPress. Think of WordPress’ Hooks as the OnRamp to the rendering of your WordPress based site. Your code will sit dormant until the moment the Hook you have ‘Hooked’ fires, then your code will jump in and be executed. Continue reading “WordPress Dev 101: Hooks” »

Change your WordPress domain quickly with Linux, MySQL, and sed

August 15th, 2010 3 comments

You have no idea how hard it was to refrain from using the command ‘sed’ in a totally ridiculous homophoned title. Have you found yourself wanting to change the domain on an established WordPress installation, or even trying to replicate many times over the same exact WordPress database on a different domain? Yeah, me too. I’ve found while doing plug-in development, it helps to have the same database information copied over when I start with a new branch. Luckily, Linux comes to the rescue with the sed command. It’s a 3 step process. Export your source/current database. Search and replace with sed, and then import the database. Here’s a step by step for you.
Continue reading “Change your WordPress domain quickly with Linux, MySQL, and sed” »

Categories: Tips Tags: , , , ,