Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

WP-Hack: find_the_category()-function

January 12th, 2005, 04:31

Because my bloody WP installation doesnt give a shit about single_cat_title(), etc. (functions to be used outside of The Loop), I’ve created myself a small nice function called find_the_category. Essentially it simply searches for a given string or array and returns both the id and the nicename of the found category or categories.

See it live in action: Screenshot (17 kb, done just a few minutes ago)
In this, I’ve been searching for the category ‘Menschsein’ ;)

Hacking/Installing instructions:

1. Simpy insert the source code at some nice place into wp-includes/template-functions-category.php

2. That’s all to it, actually. By now you am able use the function anywhere in your site, eg. in the index.php-file to perform some nice CSS magic to display posts of a specific category in another way than the rest of the posts, like I do ;)

WP, Codework | Comments Jump to the top of this page

Dear User:

Please note that this blog is not being updated anymore and only exists now for archival purposes.

Lieber Leser:

Dieses Weblog wird nicht mehr aktualisiert und existiert daher nur noch als Archiv.

Comments are closed.