cheers for that wp_guy.
EDIT: I just realised you were talking about get_categories (not get_the_category) which can be used outside the loop, in which case your post may actually prove very useful, although I’m sure get_categories uses a query too. Excuse my mistake.
…
I wasn’t very specific in my opening post though, but let me fill you in.
I’m not doing this in the loop – I’m going to assemble a page based on a user profile field, so… if you enter YourCompany in the profile field, and your user level is sufficient, you’ll be able to view a page which pulls posts from various categories with slugs such as ‘yourcompany’, ‘yourcompany-tickets’, ‘yourcompany-news’ etc.
so I will have ‘YourCompany’ as the user profile field, but now I need to pull the category IDs for each of those categories I mentioned earlier — outside the loop of course… to be stuffed into various areas like the main content and the sidebar as well.
Basically I’m trying to be a tricky bastard, to avoid having to modify templates each time there’s a new company available. I’ll just make the categories, and the page will work.
thanks for adding your 2cents though – these threads are useful forever.