Joe Levi:
a cross-discipline, multi-dimensional problem solver who thinks outside the box – but within reality™

WordPress Tip: Maintaining Custom Code across Themes/Upgrades

wordPressThose of you using WordPress as your Content Manager/’blog engine have undoubtedly been frustrated by the frequency of updates to the WordPress engine of late.

WordPress 2.1 has had 3 major “security updates” this year.

  • 2.1.2: March 02, 2007
  • 2.1.1: February 21, 2007
  • 2.1: January 22, 2007

Compare this to the 8 updates for 2.0 in 2006, which included “preview releases” in addition to “feature updates” and “security updates”:

This isn’t to say that WordPress is “buggy” by any means, just that with all these frequent (and mandatory) updates, going back in and modifying system files (specifically the footer) to include inline code to render inline advertisements and analytics tracking just adds to the pain. In that regard I have a “solution.”

Rather than placing your “every page” custom code in the footer, why not add a text-widget that contains the code that you’d normally put at the bottom of the page?

This means your code is automatically in place after you’ve verified your text widget is set to load.

There are a couple things to take note of:

  1. Your theme may not load your widgets on each page (individual articles, pages, search results, etc.). This isn’t acceptable for analytics code, so it’s back to the “manually update the common footer” method.
  2. Some themes render the widgets before the page content (which I think is bad practice). This isn’t much of a problem for page analytics, but for inline advertisements that must parse the page’s text, and if the text isn’t loaded it can’t be parsed (a “good” script would handle this situation, but you can’t rely on “good” programming).

Keeping those two items in mind, however, you might save yourself a lot of time with frequent updating.

Share

You may also like...

Leave a Reply