Perishable Press

Perishable on Tumblr-- it's about time..
May 30
Permalink

Stop Errors when Running Multiple Themes

Another quick WordPress tip for anyone running multiple themes in WordPress. If your site provides users the option of selecting from a number of different themes, you may have noticed errors like this in your PHP error log:

[28-May-2009 05:46:50] PHP Warning: main(): Failed opening ‘/…/press/wp-content/themes/requiem/searchform.php’ for inclusion (include_path=’/usr/lib/php:.:/usr/php4/lib/php:/usr/local/php4/lib/php’) in /…/press/wp-content/themes/default/sidebar.php on line 6

[28-May-2009 05:49:02] PHP Warning: main(/…/press/wp-content/themes/requiem/searchform.php): failed to open stream: No such file or directory in /…/press/wp-content/themes/default/sidebar.php on line 6

These errors happen when a user loads a page using a non-default theme that calls the searchform.php file via the following code:

<?php include (TEMPLATEPATH . ‘/searchform.php’); ?>

Since the template path is based on the default theme, this code will attempt to locate searchform.php in the default theme’s directory. Thus, non-default themes that contain this code will produce the PHP errors shown above.

Fortunately, eliminating this problem is as easy as replacing the “TEMPLATEPATH” with the actual path to the file in your theme. Something like this:

<?php include (‘/…/press/wp-content/themes/default/searchform.php’); ?>

..where the “…” (ellipses) represents something like, “home/public/domain” or similar, depending on your setup. This path must be the absolute path to work properly. Repeat this process as necessary for any other instances of “TEMPLATEPATH”.

That’s all there is to it — no more pesky PHP errors for missing template files! :)

May 27
Permalink

Maximum Characters for Google Meta Tags

I was going to post this on Twitter, but the service was down or otherwise not responsive (as it frequently is), so I decided to post the information here at Tumblr instead.

After trying to determine the maximum number of characters allowed for meta title, keywords, and description tags, I realized that the answers are not always clear, even where Google is concerned. One SEO site says one thing, someone in the Google forums says another. Bloggers and designers all seem to have their own opinions.

Fortunately, many of the proclaimed answers I encountered all seem to converge on a common set of values for the three meta tags. Here are my findings:

meta title tag: Perhaps the most widely agreed upon max-character value of the bunch, 60 characters (including spaces) seems to be the common denominator for the all-important title tag. Of course, you can make your titles as long as you want, but keep in mind that Google will only display the first 60 characters.

meta description tag: Lots of disagreement on this one, with some “experts” claiming a 160-character maximum (including spaces) and others saying that the value is more like 150. The range of values for the description tag ranged from over 200 to around 150, with 160 being a very common value. Thus, to be on the safe side, I recommend meta description tags of no more than 150 characters.

meta keywords tag: How many keywords can you stuff into the meta keywords tag? Well, that all depends on how many characters each of them contains. Lots of disagreement on this one, with lots of folks pointing out the utter foolishness of even bothering with meta keywords. Oh well, I still use them, and have determined that 800 (including spaces) seems to be a safe number of maximum characters for the meta keywords tag.

Of course, I am only blogging this info for my own future use, but I like to think of myself as a reliable source of information, so perhaps these max-character values will be useful to you as well. If you would like to chime in on the topic, please do so via Twitter. Any previous comments may be seen by clicking here.

May 19
Permalink

WordPress Theme Development Tip

Working with the Theme Switcher plugin is an excellent way to develop themes behind the scenes using WordPress. Simply install the Theme Switcher plugin, upload your working theme template files, and enter the secret URL (something like, “http://domain.tld/index.php?wptheme=Perishable”, where “Perishable” is the theme name) to activate the new theme. Easy as pie.

So that’s the scenario, and I’m sure that many of you are familiar with it. I have been using this method for years with nary an issue. Until today. Uploading a new theme that I am working on for Perishable Press, I began with the two required files: “style.css” and “index.php”. I then added a header and footer file and began fleshing things out with some basic functionality and markup. So far so good.

Then, after getting the header.php, index.php, and style.css files properly configured, I uploaded the batch fresh and went to check on the scene in Firefox. Uh-oh, not good. The header and CSS were loading fine, but the index.php file was not being loaded. Instead of the index file that I had created, WordPress was delivering up the default theme’s index.php file. No matter what I tried — clearing the cache, logging in/out of admin, deleting and re-uploading files, swapping out template code, and everything else I could think of — I just couldn’t get the new theme’s index.php file to load.

Fortunately, persistence pays off. After taking a quick break, I came back to realize that I had yet to add any code to the footer.php file. Aha! That was it. For some reason, if WordPress detects a blank footer.php file, it will assume that something is wrong and serve the index.php, footer.php, and other missing files from the default theme. And, I haven’t tested this, but I assume that WordPress does this when any non-required template files are blank (e.g., sidebar.php, search.php, category.php, et al).

In any case, after slapping a few lines of code into the blank footer.php file, everything began loading as expected — the new index.php appeared and that hideous default index.php finally went bye-bye.

Apr 29
Permalink

Easy Wordpad to Notepad Format Conversion

I do most of my writing and coding in a plain text editor. On many machines, this means Notepad. I think Notepad is one of the greatest applications of all time. So Zen and perfect in its simplicity.

While working with plain text, I am often required to convert text content between Notepad and Wordpad. Wordpad is also a great text tool, but the rich-text formatting doesn’t translate well into the plain-text format used by Notepad.

For example, while working on my latest project in Google Docs, I take advantage of the “Save to txt file” option in order to take a copy of my work with me on the road. As expected, however, the saved txt file is in rich-text format and thus looks like a garbled mess when opened in Notepad.

Although I could work directly in Wordpad and avoid the formatting discrepancy entirely, I don’t like the way Wordpad “jumps” to the last “point-of-edit” after each save. And I save my work a lot, so Wordpad is out.

Here’s the rub: any .txt file can be opened and edited by either Wordpad or Notepad. When the .txt file is encoded in rich-text format, opening the file in Wordpad retains the formatting (spaces, breaks, characters, etc.), but it becomes a garbled mess of “text soup” when opened in Notepad.

Fortunately, I have found an easy fix for this that I want to share with you (and myself for future reference). Converting the rich-text formatting into plain-text formatting is as easy as opening the .txt file in Wordpad and then explicitly saving the file via “File > Save”. After that, open the file in Notepad and the text will be well-formatted and ready for further editing.

Click, click — Done! :)

Apr 05
Permalink

Column Sorting in Dreamweaver

The other day I “did something” that resulted in my Files directory listings being displayed in a completely wrong sort order. Instead of sorting my files and folders alphabetically and according to name as it has always done in the past, Dreamweaver suddenly began displaying everything according to most-recently modified or something similarly confusing. At the time, I had no idea what I had clicked or changed to change the sort order, but I knew I couldn’t work with my files all chaotic like that.

After searching Google for a solution, I gave up. I either wasn’t able to clarify my search query or else information on my particular version of Dreamweaver is quickly disappearing from the Web. In either case, I had no choice but to press on and begin learning how to adapt to a virtually random file arrangement. After a week or so of fighting it, I finally decided it was time to either fix the issue or move on to a new FTP/file-management/file-editing program (which is pretty much all I use DW for anyway). After another go, I still couldn’t locate anything helpful on the topic via Google, so I turned to Twitter instead. Several tweets later, the solution was graciously provided by the always helpful Marty Martin.

The thing that killed me was the utter ease and obviousness of the solution. Seriously, you will laugh when hear how easy it is to re-sort your Dreamweaver files: switch to the double-pane view for your local/remote files by clicking on the “expand/collapse” button and then click any column’s heading to sort accordingly. That’s all there is to it. I feel like a ham for not figuring this out myself — especially after having used good ol’ Dreamweaver for over five years now. I guess there’s always something new to learn, especially with software.

Mar 16
Permalink

Starting Over

I have been doing a lot of thinking about starting over with my blog here at Perishable Press. Now that I know what I’m doing, I can’t help but notice how absolutely wrong my blog’s foundation is setup. What was I thinking!

There are so many things that I would do differently if I had the chance to start over. With almost 20 fully functional themes and a host of plugins and custom functions, the idea of upgrading the site scares me pretty badly. It would no doubt take several days — which I don’t have — to go through and check everything, make repairs, and so on.

The site has grown tremendously huge in terms of both content and files, such that major changes are practically impossible. My idea of developing a massive, all-encompassing library-type repository of all my design ideas has somehow backfired with the knowledge that I have acquired while building it. I need to start over, and I won’t be taking the old site with me.

Jan 27
Permalink

10 Pop Songs that Rock

Normally, I listen to a ton of techno, downtempo, and ambient music. I also like jazz, classic rock, and tons and tons of Underworld. There is so much music to enjoy while working on the Web, that I often don’t find time to dig much pop stuff. Every now and then, while surfing the digital divide, I happen to catch echo of some choice pop nostalgia. Collecting as I go, here are ten of my recent favorite pop songs:

  • Hello (I Love You) - Roger Waters
  • Rocket Man (I Think it’s Going to be a Long Long Time) - Elton John
  • Right Back Where We Started From - Maxine Nightingale
  • Sweet Emotion (David Thoener Remix) - Aerosmith
  • Lovin’, Touchin’, Squeezin’ - Journey
  • Early Morning Rain - Gordon Lightfoot
  • Reminiscing - Little River Band
  • Straight Edge - Minor Threat ;)
  • Let Your Love Flow - Bellamy Brothers
  • Stuck in the Middle with You - Stealers Wheel
Jan 04
Permalink

WordPress Tip for Multiple Themes

If your site makes available multiple themes for users to choose from, remember to include the JavaScript (or any other required code) for any statistical applications that you might be using, such as Mint, Google Analytics, and so forth. I am not sure about the various WordPress statistics plugins, but they may need to be included as well. A good way to check if your stats plugin is tracking data across all themes is to either visit a few pages that you know others aren’t hitting, or else activate each of the alternate themes and check the source code of each one for the required code.

Earlier today, I realized that only several of my most recent themes included the required JavaScript for Mint and Google Analytics. I am now in the process of editing each of the 18 themes available for users at Perishable Press. Haven’t decided on whether or not both statistics apps are needed for all themes, but I will certainly be using at least one of them to keep an eye on everything.

Dec 22
Permalink

Insane Christmas

For as long as I can remember, Christmas has always been a relatively peaceful affair. Sure there’s the usual holiday stress — traffic, shopping, presents, relatives, and all that goes with the preparation of a traditional celebration, but when it’s all said and done, you get to relax and enjoy the peace and harmony of gathering together and basking in the reason for the season: the birth of Christ.

This year, however, the stress factor has been kicked up a few notches, making for a rather insane Christmas if I do say so myself. In addition to the usual holiday chaos, we are currently purchasing a brand new home, and quickly realizing the incredible amount of work involved in the process. If you’ve ever bought a newly built home, you know exactly what I am talking about here.

Plus, as if all the paperwork, inspections, insurance, costs, and anxious anticipation weren’t enough to confound the usual holiday stress, we are also packing up everything, dealing with kids, working full-time jobs, and — beginning on Christmas Eve — moving into our new house.

It certainly is all a great joy and blessing to have such amazing things going on, but combined with the work that I do on the Web — blogging, designing, projects, helping people, and so on — it really becomes all too much rather quickly. We are doing are best to get through everything with our sanity intact, but I have to admit that this is the most insane Christmas I have ever experienced.

Permalink

New (4G) Blacklist Now in Beta

Just a quick note to anyone interested in securing their websites against malicious activity, spam, and other nonsense. Several months after releasing my 3G Blacklist, I have finally begun work on the next incarnation of the blacklist: the 4G Firewall!

The first part of the blacklist is now ready for testing, and I plan on setting it up on Perishable Press within the next few days. While testing on my own site, I thought it would beneficial to also invite a few “beta” testers to run the code on their own site(s) as well.

So, if you have a site that receives its share of malicious attacks, and cracker exploits, drop me a line via the contact form at Perishable Press and I will send you the initial block of HTAccess directives. This version of the Blacklist is looking better than ever, and I look forward to releasing the complete version to the public early in 2009.

Dec 07
Permalink

Thanks for the Free Traffic and Link Juice

Just wanted to thank the fine folks at fafich.ufmg.br for all the free traffic and link juice. Thanks to their misapplication of my comprehensive canonicalization code, every non-canonical version of their 21,700 indexed pages points directly to my site, Perishable Press. This means that every one of their permalink URLs that is mistyped, lacks the “www” prefix, or contains the superfluous “index.php” file name is directed via permanent redirect directly to the home page of my site.

I have tried contacting the site owner(s) about this situation, but it has been over a week and I have yet to hear anything back. Hopefully, they will take notice soon and correct the issue by properly configuring their htaccess file, but in the meantime, I certainly don’t mind the extra link juice and free traffic! :)