Maria’s Guides

Support and additional material for readers of books, articles, and digital media by Maria Langer.


Random Book Cover #1Random Book Cover #2Random Book Cover #3Random Book Cover #4Random Book Cover #5Random Book Cover #6Random Book Cover #7Random Book Cover #8Random Book Cover #9

Splitting a WordPress Category List

Posted on May 11th, 2006 at 2:33 pm · 3 Comments
Filed in: RSS WordPress Books   

A quick how-to for WordPress users.

When I rolled my book support Web site, LangerBooks.com, into this site — my personal site and blog — I needed to make a clear distinction between the categories that I maintained to support my books and those that were part of my blog. I wanted to make it very easy for readers looking for more information and support to find the information they sought. I achieved this goal by displaying the two groups of categories separately, each under its own heading.

Check out the sidebar to see for yourself. The Book Support heading lists all book support categories (one per title that I support). A list of links appears under the Publisher Links heading that comes next. Then the Maria’s WebLog heading lists all categories that are part of my WebLog.

I could think of two ways to do this with WordPress. Unfortunately, I chose the hard way.

To get the category list in the sidebar, I included the wp_list_cats tag in the sidebar.php file. (Forgive me for not going into detail about that — Miraz and I cover it in detail in our upcoming WordPress book.) I prefer wp_list_cats over list_cats because I find it easier to enter the arguments in the single string format it offers.

The first (hard) way to separate the category list into two groups is with the exclude argument. For example,

wp_list_cats('sort_column=name&optioncount=0&exclude=10,15')

instructs WordPress to list all categories, sorted by name, without post count, except categories 10 and 15. To make this work, I had to construct two separate commands: one for Book Support that excluded the Maria’s WebLog categories and one for Maria’s WebLog that excluded the Book Support categories. At the time, this seemed to make sense, since I was not using a category/subcategory structure and I didn’t expect to add any more categories. In reality, I was just being lazy — and I paid for it.

Of course, I did add more categories. And what do you think happened? The new category was listed under both headings because it hadn’t been excluded from either one. So every time I added a category, I had to tweak one of the two lines of code in the sidebar.php file. Not exactly something I wanted to remember to do.

So I did it the smart (right) way. I created two new categories: Book Support and Maria’s WebLog. Then I went into the Manage Categories administration panel and I edited every category (other than the two new ones) so it was a subcategory of one of the new ones. Finally, I went back into the sidebar.php file and replaced the two original wp_list_cats lines with a line like this:

wp_list_cats('optioncount=0&child_of=35&sort_column=name')

This says to list all categories, without a post count, that are the child (subcategory) of category 35, sorted by name.

Now every time I add a new subcategory, all I have to do is immediately assign it to the correct main category. It will appear under the correct heading. Quicker, easier, and it works.

Of course, you can split your category list by as many parent categories as you like. You don’t even have to list them all in the sidebar. This seems to be the best way to do it. Give it a try and see for yourself.

Oh, and by the way, you can learn more about the wp_list_cats tag in the WordPress Codex. The Codex is an excellent source of information about WordPress with just two tiny problems: some information is a bit tough to find and other information isn’t exactly up to date. But the template tag information is right on target and easy to find.

→ 3 Comments • Read 856 Times
Add to Del.icio.usAdd to Del.icio.us • Technorati ThisTechnorati This • Digg ThisDigg This • Stumble ItStumble it! • Twit ThisTwit This


RiteOfTongue

Posted on May 11th, 2006 at 11:31 am · No Comments
Filed in: RSS Mac OS Books   

A Firefox Web browser spelling checker extension.

As I’ve mentioned elsewhere in this blog, I’ve discovered that I’ve become almost dependent on automatic spelling checkers like the one in Microsoft Word to check my typing for spelling and typographical errors. Trouble is, an automatic spelling checker is not always available.

Like right now. I’m creating a new post in my WordPress-based blog. To do that, I fire up my favorite Web browser, Firefox, and fill in a form. If, while I’m typing, I realize that I’m not sure about the speling of a word, there’s nothing built into Firefox that’ll identify the misspelled word in a form.

Dictionary WidgetI used to use the Dictionary widget to check my spelling. Press F12, type the spelling in the Dictionary widget box, and press Return. If I spelled it right, the definition appears. If I spelled it wrong, either a different word’s definition appears or the Dictionary widget tells me that the word can’t be found. I then spend some time typing in other suggestions. Not very productive or fun — although I have learned a few new words.

RightOfTongueEnter RiteOfTongue by Terry Yuen. This Firefox extension adds a Suggest option to the bottom of the contextual menu that appears when you select a word in a form, hold down the Control key, and click on the selection (or just right click, if you have a two-button mouse).

To check the word’s spelling, choose Suggest and wait a moment.

RightOfTongueIf the word is correctly spelled, the Suggest option turns into a gray Correct item with a green check mark before it.

RightOfTongueIf the word is not correctly spelled, a pop-up menu displays possible suggestions. Pick the one you want to use and it’s automatically inserted in place of the selected word.

Of course, you have to check a word to correct it. If you think you have it spelled correctly and don’t bother to check it, this extension won’t help you.

And I’ll use that excuse for any typos or spelling errors you see in my blog from this point on.

→ No Comments • Read 283 Times
Add to Del.icio.usAdd to Del.icio.us • Technorati ThisTechnorati This • Digg ThisDigg This • Stumble ItStumble it! • Twit ThisTwit This