What Was I Thinking?

Weekly Update 1

with one comment

Lots of progress this week. I have been obsessing over the project slightly. Worked on it all day yesterday, most of today and 3 evenings during the week.

At the moment, I’m focusing on developing a suitable WordPress theme. The main information pages are rather specialised so I shall have to give you an explanation as to how it will work.

Single posts providing information on [my secret topic] will actually show multiple posts. The first post will be the main information section. Registered users will be able to write their own posts providing tips and and their own experiences with [secret topic item]

To this end I need to use multiple loops on the post pages for that category. I will also need to take a parameter from the initial post and pass it into the secondary loop in order to get the correct set of posts. e better part of a day peering through the php files and function. I finally adapted a few to pass the ta

Sounds tricky, no? I spent several hours yesterday and today looking at tagging plugins to do the job. The idea was that I tag the initial post with something, then pass that tag over to the secondary loop. That loop will then pull tips and article posts with the same tag.

Turns out that no tagging plugins will let you extract only the tagged posts under a certain category. Even less helpfully, they won’t let me access the tag variable – Ultimate Tag Warrior outputs the tags in such a way that I can’t store them as a variable. Finally, there’s no accessible function I can use to pass in a tag and get the posts back for my secondary loop. I spent thgs into a usable variable… and you know what?

WordPress 2.3 (release date 24th September) will have tagging BUILT IN! Aaaaargh… all that work!

Never mind. Built-in is all the better. I like to minimise my plugin usage so that I’m not reliant on other people for upgrade. Guess I won’t be launching before September 24th.

The other tricky part was the navigation. Each post needs to be in multiple categories and multiple subcategories. For example – let’s say I was listing information about shoes. For each shoe I would have the following:

  • Manufacturer: Nike
  • Colours: Red, Black, White
  • Materials: Cotton, Plastic

I want to be able to click on each of the above fields to find shoes with similar properties. To do this, Manufacturer, Colours and Materials are parent categories. Nike, Red, Black, etc. are subcategories.

The problem is, there is no way within WordPress 2.2 to only list the post’s subcategories of a given parent. You can list all the post’s categories, and the subcategories of a given parent for the entire website, but not for the post. I wrote a plugin to do the job. I’ve (imaginatively) called it ‘Weefz’s Show Post Subcategories’. I’ll probably release it properly later this month so drop me a comment if you want the plugin. It’s quite simple so should work with pretty much any version of WordPress. You can even customise the output with your own separators, prefix and suffix.

Equally, let me know if there actually is a WordPress template tag that shows only the post’s subcategories of a given parent category. I couldn’t find it.

Achievements:

  • Wrote my first plugin, in a programming language I don’t even know. Hooray! :) (I am a trained programmer, so it’s not as ugly as this makes it sound ;)
  • Tabbed navigation with rounded corners. (Woooo!)
  • CSS drop shadows. (For that professional look)
  • And a “single” post template that incorporates multiple WordPress loops.

Sure, basic stuff for a web developer but all new to me. I am happy :)

Advertisements

Written by Weefz

9 September, 2007 at 7:45 pm

One Response

Subscribe to comments with RSS.

  1. […] something together only to find out that it’s already available out-of-the-box in 2.3. Spent enough time on that with tags, […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: