Perishable Press

Perishable on Tumblr-- it's about time..
Nov 01
Permalink

Insane October

By far the most insane month of 2009, October included the following activities:

1st week: Trip to the East Coast, beginning with some business in Connecticut.

2nd week: East Coast trip continues with much pleasure in downtown Manhattan.

3rd week: Photo and art excursions with good friend visiting from Portland, OR.

4th week: Marathon book-editing and fine-tuning for Digging into WordPress.

Now that November is here, things remain busy, but I am hoping to get a chance to restore some balance and regain my equilibrium. Of course, the holidays are right around the corner..

Sep 07
Permalink

Import Feeds to Facebook

Seems like a lot of misinformation and confusion out there on how to import and display your feeds on Facebook. Here is what worked for me:

1. In the lower left-hand corner of your Facebook account, click on “Applications” > “Notes”.

2. In the upper mid-right column, click on “Import a blog” in the “Notes Settings” panel.

3. In the “Import an External Blog” panel, enter your feed URL and check the little box.

4. Click the “Start importing” button and then click on “Confirm Import” on the preview page.

That’s all there is to it. Don’t forget to edit your “Notes Privacy” settings to ensure that people can see and comment on your imported feed items.

Once you successfully import your feed(s), they will appear by clicking on the “Notes” button in the left sidebar of your Home page. Also, your timeline or “Wall” will also display the most recent post from each of your feeds as they are published and pulled into Facebook. This makes it easy for your “Friends” to see what you have been up to elsewhere on the Web.

Aug 31
Permalink

help me in plain english

This has got to be the most ironic comment I have ever read:

“hi i dun a stupid noooby mistake and dint think about encrytion i just put a pass in the change pass box and now when i attempt to see my main.php or index.php its sayin password no and error how can i reset back to having no password or were can i edit the bit so that a pass is automattically seen or if not posable how can i make it so i can put in the pass i made at some point so i can login this way? the 3rd is most prefered as this will help me with other projects i am planning as i am a php noob :s plz sum1 hu is clever help me in plain english”

Thanks, “jay” — you made my week with that one.

Aug 04
Permalink

Redirection After Registration

After searching high and low for an unobtrusive method of redirecting users to a custom URL after registering at a WordPress-powered site, I finally resorted to (gasp) hacking the core. I simply could not find a better way of doing it that didn’t require a ton of additional code. I found several ways of redirecting users to various URLs after logging in and out, but absolutely nothing seems to exist on redirecting users to, say, the home page, or better yet, back to the current page after registering as a subscriber (or whatever role the Admin has set for new registrations). Indeed, the only way to direct a user to some page other than the default WordPress “Registration complete. Please check your e-mail.” screen (which looks just like the WP Login page, btw) is to hack the wp-login.php file.

Thus, for the sake of remembering this technique, helping others, and/or “inspiring” someone to find a solution, here’s how to hack WordPress to change the page that users are directed to after they register (via submission of a username and email address). First, open the wp-login.php file and find the line that says, “wp_redirect('wp-login.php?checkemail=registered');”. That’s the key right there. To change the location, replace the part that says, “wp-login.php?checkemail=registered” with the URL to which you would like to direct the newly registered users. You may use full URLs or even relative paths to a specific file. That’s all there is to it. It’s still hacking the core, but not by much ;)

Remember, if you’re going to hack the core, make a note of the change(s) and refer to it before/after each subsequent upgrade.

Jul 09
Permalink

A 500KB wp_options Table is Too Much

After my server crashed, I found myself restoring my site’s WordPress database. While there, I decided to dig around a bit and make sure everything was up to snuff. While looking through the wp_options table, I was surprised to discover that WordPress seems to cache around 400KB of “Planet WordPress” dashboard feeds (among other things). That’s a little extreme if you ask me, so I decided to clean things up and reduce my overall database size by around half a megabyte. Here’s how I did it using my archaic 2.3 version of WordPress and phpMyAdmin.

Step One: Take Some Notes

Before doing anything, copy and paste a few text snippets from your dashboard feeds. This will enable you to easily locate the oversize options fields for removal in Step Three. Note: permalinks from the various feed entries make for good search candidates.

Step Two: Kill the Feed

Place this in your theme’s functions.php file (props to Michael Shadle for the code):

function remove_dashboard_feeds() {
remove_action(‘admin_head’, ‘index_js’);
}
add_action(‘admin_head’, ‘remove_dashboard_feeds’, 1);

Step Three: Clean up Your wp_options Table

Once that is done, you may clean up your database by doing a quick search for some of the text snippets (permalinks work great) that you copied from the dashboard feeds in Step One. The field(s) that you find should be named something like “rss_123abc…”, where the “123abc…” is some long, apparently random alphanumeric string. Once you have disabled the feed via functions.php, feel free to reduce the size of your database by deleting the field(s) used to store data for the dashboard feed.

Doing this saved me an extra ~400KB of space, which is much-needed as the size of my Perishable Press database continues to grow.

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.