Software

How to get a categories widget with include and exclude

By Branch, August 5th, 2008

So, as things stand, the WordPress Categories widget supports altering sort order, post count and dropdown vs. hierarchical display. But it does not support including or excluding categories.

There is a way around this, though, while we wait for it to show up in the core code! (Everyone thank Bricksmith for suggesting this work-around.)

First, you need to download, upload and activate the php-exec plugin. This plugin allows admins to put php code in an entry or widget and have WordPress recognize it as php and execute it instead of just treating it as plain text.

Next, you go to Design > Widgets and put the Text widget where you want the Categories to appear.

Into the Text widget you paste some variation on the following code:

<li id=”categories-1″ class=”widget-categories”>
<h2 class=”widgettitle”>Categories</h2>
<ul>
<?php wp_list_categories(‘orderby=name&hierarchical=true&title_li=&exclude=76,77,78,79′); ?>
</ul>
</li>

Save that and voila, you have a pseudo Categories widget!

In my own case, I wanted to have two Categories widgets, the second one including all the categories that the first one excluded, so I pasted another copy into Text right under the first, with the ID “categories-2″ and the ‘exclude’ changed to ‘include’, and edited my CSS to add #categories-2 everywhere there was a #categories-1.

Caveats: 1) I do not know if it is possible to use this for a dropdown Categories, because that requires some Javascript and I have no idea whether that can be parsed inside a Text widget. 2) What you have is actually a widget inside a widget, codewise. The Categories widget is enclosed inside the li and div of the Text widget. This may cause problems with your CSS styling, depending on how it’s written. If your nested lists look like li li { rules }, this will probably cause problems. On the bright side, if you change it to ul ul { rules } that should fix the problem.

For a full list of the variables you can adjust in wp_list_categories, see the WP documentation.

Manga viewer for Macs

By Branch, November 28th, 2007

I have recently been test-driving a lot of different image viewers, specifically viewers for Mac. My criteria were not the usual ones; normally, when I want to take a quick peek, Preview does fine and if I want more than that, well that’s what Photoshop is for. In this case, I was looking specifically for something to use as a manga viewer.

My priorities, thus, were something that has a large viewing area, something that can easily resize and be set to show images at actual size, and something that can easily navigate among nested folders.

CocoViewX is the winner.

I highly recommend this bit of software to any Mac user who has a lot of folders of manga that she would like to view easily. For one thing, it’s freeware, though I encourage anyone who likes it to toss a buck or two in the author’s donation bin. For another, there are a bunch of settings you can manipulate, to change how you view the pages, and the program will remember all of them–including whether you want to view actual size or fit the window.

Most importantly, from the perspective of a manga-viewer, there is a navigation window down the left side that shows all subfolders and files in any folder you open, and you can navigate among your folders and image files simply by clicking. You can even set it to single or double click, as you prefer.

Altogether, CocoViewX is just about ideal for the purpose. The only way I think it could get much better is to include an option to scale the images by percentage of actual size. However, since I know of no image viewer anywhere that does that, the lack does not detract from CocoViewX’s win.

General Note: One thing I have realized, in the course of testing different viewers on my files, is that any viewer you use should be set to not respect the dpi (dots per inch) of the image file. Apparently, in the course of translating and/or cleaning image files, it is not infrequent for a mis-setting of the dpi to occur that will force your viewer to display the image at a wee, tiny size if you have it set to believe the dpi given by the file meta-information.