WordPress Widget: King Categories
First off i must say that the wordpress widgets plugin deeply impressed me. In fact, half an hour after MP:Ole pointed me to it, i had my first widget written.
Widgets will revolutionize the way normal users can interact with wordpress.
Therefore i wanted to write a plugin for one of the most used (and at least by me, most hated) wordpress template placeholder … the list_cats() It´s used for the category listing in the sidebar or somewhere else in your Website.
This function has a big ass eighteen Variables long parameter list, which let me struggle again and again. Also because there are big differences between setting a var to "false" or "0" (nicely mixed up in template-functions-category.php Line: 277 ).
I always ended up in an hour of trial and error until i had my custom category navigation build.
Anyway this WordPress Widget will hopefully wipe away your fear of the list categories function and makes it easy to screw around in the category navigation.
Features / Changelog
Version 0.93
– BUG when selected show only in xy Category widget would show everywhere (thanks Klaus)
Version 0.92
– NEW Remote Version check
- NEW Complete "Where To Show" Options. With the new option to have a comma seperated list of siteArea´s (single Pages/ID/Slugs) where to show
- NEW copy Options from another category widget
– NEW Options dumper
Version 0.85
- small fixes to ensure compatibility with new framework structure
– nicer JS Menu using moofx (framework improvement)
– Help Titles are now shown only in widget area (framework improvement)
– changed widget admin title back to "King Cat xy" because with my widget title hack you need the place to show the real title
Version 0.8
- Enhanced JS Navigation for Widget Options. It now fits better on small Monitors and does not overwelm you that much
- Option to use the Fold Category Navigation if installed
- Bugfix in Setting of Default Option
- renamed widget header to "King Category Menu xx"
- Moved Framework into new Folder ->plugins/king-includes/
- moved Admin Head includes into framework
Known Issues:
- The JS Accordeon Admin Menu is now closing the right way if multiple instances of the widget are used. But not in IE..the settings are not influenced by this! Read more in the Framework Article.
Maybe some JavaScript Pro can assist me with that … Help!
————–
Version 0.71
- MULTIPLE Category Menu´s
- 4 HTML fields to customize before/after Widget and Title
- Option to insert default category menu options
- enhanced underlying Framework (If you don´t want to change the engine .. no need to look under the hood)
Version 0.6
- 15 Option fields to set all Category List options – list_cats() in Admin Widget Area resulting in a fully customizable Category menu without coding.
- option for debugging output in Frontend
- js help tooltips
- full gettext translation currently available languages: German / English
Screenshots
Version 0.8 Widget Admin Area with new AJAX Foldable Menu (this has slightly changed with version 0.85 and look a bit nicer..screens will follow )
Version 0.7 English and German Admin Screen.Please Klick to enlarge.
Comming Features
- Option to show a Category menu only under a given Category. Very usefull if you have deeply nested Categories… if you need this urgendly write me because it´s nearly finished
- copy Options from another category widget
- Options dumper
- option to toggle help titles on/off because they apply to every label elemet in admin area or maybe different implementation method (Ajax)
- fold the admin menu to group the options into smaller sets because the popup is kinda big right now on small monitors and might be confusing for beginners
- Foldable category list
- more than one Category Navigation like text or rss widget fields
- before and after fields for layout can be set in Admin Area
Install
Of course you should have wordpress widgets installed and activated. If not, you can find the download and install instructions over at automattic.com
- Copy king_categories.php into your plugins widget folder -> where your widgets.php is !!!
- Copy king-includes (the widget Framework) into plugins
- activate in Pluginarea.
- Drag the King Categories Widget on one of your sidebars and play with the options. In the Advanced Options Tab you´ll find a switch for inserting WordPress Defaults to get a Start.
Update
- Copy king_categories.php over your existing File.
- Since the Framework was moved you should delete the existing king-includes folder and copy the new king-includes into the /plugins Rootfolder
- The name of the Widget has changed (again sorry) so you need to drop it again onto your sidebar
Download
Version 0.93
king-categories_0.93.zip (05.09.2006 09:47)
Version 0.92
- needs the King Widget framework from version 0.70 and up
king-categories_0.92.zip (03.09.2006 14:50)
Version 0.85
- the King Widget framework is now keept seperate, make sure you get it too
king-categories_0.85.zip (07.05.2006 03:35)
Old Versions
Version 0.8
- including king-includes (the widget framework) svn Version 102
– german mo and po files
king_categories_0.8.zip (23.04.2006 19:38)
Version 0.71
– including german po and mo files
– including king widget framework in king_widgets_inc
king_categories_0.7.zip (15.04.2006 15:34)
Please don´t hesitate to give me a feedback if this is usefull or if you think you found a bug!
Have fun!
Georg Leciejewski
WordPress Widget: King Categories
You can follow all the replies to this entry through the comments feed.
WordPress Widget: King Categories
- By on 05.07.2009 at 15:36
- By on 12.10.2008 at 14:06
- By on 07.12.2007 at 17:37
- By on 18.07.2007 at 18:23
- By on 17.05.2007 at 0:42
- By on 17.05.2007 at 0:41
- By on 26.12.2006 at 15:33
- By on 11.12.2006 at 0:56
- By on 07.12.2006 at 3:00
- By on 27.11.2006 at 19:48
- By on 19.11.2006 at 13:49
- By on 14.11.2006 at 5:33
- By on 02.10.2006 at 18:27
- By on 02.09.2006 at 5:46
- By on 14.08.2006 at 10:37
- By on 15.07.2006 at 22:50
- By on 09.07.2006 at 21:25




Bah! I’m so close… but the “Children of” feature isn’t working. I get the children AND all of the top-level categories, including the “empty” parent category of the children I’m trying to show (“Review”).
Help?
I can’t seem to find my widgets.php. Please help
Hallo Schorsch,
das King-Kategorie Plugin klappt soweit jetzt wunderbar, das einzige was es noch perfekter machen wuerde, wenn die Oberkategorien die Anzahl der Beitraege in den dazugehoerigen Unterkategorien zusammenzaehlen wuerden. Z.B. Auf meiner Seite die Kategorie “Gallery” (0 Beitraege) hat eine Unterkategorie “00er” (0 Beitraege) und diese hat unter anderem die Unterkategorie “’06″ (2 Beitraege) es waere super, wenn die Ueberkategorien “00er” und “Gallery” auch eine 2 in der Beitraganzahl dahinter anzeigen wuerde anstatt einer 0. Also sprich die Unterkategorien zusammenzaehlt.
Ich hoffe du konntest mir folgen
Danke
Alex
Kann es sein wir reden da von zwei verschiedenen Dingen. Du schreibst +30,9. Feld Bezeichung Category ID. An dieser Stelle läßt sich aber nur eine ganzzahlige Ziffer max 3 Stellen eintragen !
Es handelt sich um das erste Eingabefeld von oben, NICHT um das ganz unten.
Also Feld Show only inside Category: aktiv
Feld Category ID=25
alle weiteren Felder nicht aktiv.
Dann wird dieses Menue nirgends mehr angezeigt, auch nicht in Kat 25.
Grüße
check mal die anzeigeoptionen im wordpress codex unter “conditional_tags”. da sind die auswahloptions erklärt und vielleicht hackt es daran. ich hab es ausprobiert mit schalter is_category + 30,9 (also nur diese cat id´s) und es klappte ohne probs
Hallo Admin,
habe gerade festgestellt das es immer noch hakt…
Gebe ich jetzt an nur in z.B.Kat 25 oder 26 anzeigen, wird es überhauptnicht mehr angezeigt.
Weder in der ausgewählten noch in einer anderen Kat.
Schaue mal test.ipp-travel.com ( Suchen=25 Info=26 ) da sollte dann jeweils ein eigenes Menue erscheinen.
Grüße Klaus
hi klaus, vielen dank für dein feedback.
dein problem mit dem aufklappmenue ist nicht an das widget gebunden, sondern in dem entsprechenden plugin zu finden.
DIe Probleme mit den anderen Plugins konnte ich noch nicht lokalieiseren. du musst das framework aber nicht aktivieren. das ist nur für den versionscheck sinnvoll.
Leider gibt es noch einen Fehler.
Die Funktion zeige nur in dieser Kategorie an, als Button aktivieren und die Ziffer der Kat eintragen, bleibt ohne Wirkung.
Das Menue wird trotzdem in allen Kat angezeigt….
Grueße Klaus
Wollte nochmal nachfragen an welcher Stelle es möglich ist den falschen /li tag gegen einen /ul Tag auszutauschen.
so sieht es jetzt aus
| – 1 Ebene
| – | – 2 Ebene
| – | – | – 3 Ebene
2x /ul nötig !! aber nur 1x vorhanden
| – | – 1 Ebene
so sollte es aber sein
| – 1 Ebene
| – | – 2 Ebene
| – | – | – 3 Ebene
| – 1 Ebene
Leider gibt es offenbar weitere Bugs im Kings Framework 0.7. Bekomme haufenweise Fehlermeldungen seit der Installation im Zusammenhang mit Plugin Post_Level und aLink.
Nach dem abschalten von Kings Framework läuft alles normal wie zuvor.
Beste Grüße
Can you please tell me if i can stop posts showing unless user nagivates to that category?
IE not all the posts of the children to show up in the main parent.
please advise what options i have to use if its possible..
thanks!! having fun with all ur widgets
Ein tolles Plugin, habe es soeben eingebaut da es das derzeit einzige ist welches hervorragend die Aufklappmenu unterstützt.
Bin aber auf einen Bug gestoßen. Undzwar klappt es mit dem aufklappen nur bis zur 2. Ebene, danach schleicht sich ein Fehler ein.
Es fehlt offenbar ein , dadurch werden alle folgenden Menue der 2. Ebene zu weit nach rechts verschoben.
Siehe Beispiel. Wie bekommen ich am Ende der dritten Ebene ein zusätzliches Schließ Tag hinein ???
Herzliche Grüße
| – IPP Top Partner
| – | – Webseite eintragen
| – | – | – Jens Test Kat
http://test.ipptravel.com/?cat=82
Please update the framework too. There is a new function.
Simply amazing! I request a feature while late nite browsing, sleep, wake up, and its there! Knowing that you worked this quickly bring me chills! It seems to be the perfect addition, except I am getting an the following error. I tried various settings, each returning an error, even with the most basic settings : “Show only on special page area, and is_home”
“Fatal error: Call to undefined function: king_in_site_area() in …/king-categories.php on line 112″
HELP! Thanks, Matt
Thanks for your feedback matt. i´m was kina busy the last month, so my pdates are a little behind. I´ll just updaed the King Categories widget to suit your requests.
“Coming Features: Option to show a Category menu only under a given Category. Very usefull if you have deeply nested Categories… if you need this urgendly write me because it´s nearly finished”
IM URGENTLY WIRTING YOU! These features would create the ultimate navigation plugin.
1. If you could select to show the category menu only while browsing a specific category, or the children of that category, or both.
2. The same thing, only with pages. If you could select to show a certain category menu only while browsing a specific page, or the children of that page, or both. Ive seen this done with a drupal category module by using /page_name/* , with the * acting as a catch all for any page under /page_name/ .
This flexability would solidify these already rock-solid plugins.
Thanks for the great work!
when hirachical is in the subcategirues are shown under the main inside their own ul/li .. this can be formated whith css.
hava a look into your html code to see the differences. then get yourself firefox + the webdeveloper plugin and start playing with the css.
thanks for this plugins but i want to know, if it’s possible, how manipulate my CSS to show hierarchical ?
sorry for my english … i’m french
I already prepared a major Update and will see what i can do.
Is it possible to use your “sliding box” effect from the king text widget with king categories as well?
I know that king categories can collapse categories other than the current category but I’d really like to be able to hide the entire category list (except for the title) until it’s needed.
@pramudita: Sorry i´m the wrong address for that
. This function comes from the wordPress Core.
Yes…is show 1970 if there is no post at that category. maybe for future version the date can representing the date of category was created if there was no new article at that category…just my suggestion
Thanks
@Pramudita
I don´t think this comes from the widget since it is using just the normal wp_list_cats() function and is not changing anything in your categories.
The date is representing the Date of the last article, so if there is no new article inside it might show 1970??
Found wrong date for my categories (1970-01-01 must be 2006-06-07), but it’s OK for child categories.
how to solve this ?
Thank You
I did not encounter that till now. To test you can also try to use the direct folding cat-list call: wswwpx_list_cats(); inside your templates or the king text widget (using php).(to see if the problem is with my widget or not)
You should also try with all other widget switches disabled to find the problem.
Another point is to have content in all of the categories and of course enable the folding plugin (sorry but some people forget)
Hi,
i’ve some problems to get the categories work with folding; I installed the Fold Category List plugin, but it doesn’seem to work. When I check the box; Use Foldable Navigation in the King Cat widget, it just doesn’t show the children, but nottin is folding;)
is this a known problem?.. what am i doing wrong?
Im setting op the blog on http://www.outbox.nl/blog/
Georg, thank you for your prompt response! The problem was that I didn’t activated the Widgets plugin (duh!). Now I did activated the Widgets plugin, and the King Category plugin, but I’m not able to see the full customizing menu that you’re describing. I only have access (in Presentation > Sidebar Widgets) to a short King Category Menu that’s asking “How many Category Menus would you like?”
I have the framework installed in /plugins/ – but I can’t find the option to activate it from the Plugins menu. Is that the cause I’m not seeing the full menu for the widget?
Thank you!
Thanks for the tip about the plugin. The html errors don’t seem to be in that error – it seems to be some other problem, maybe a conflict with the theme. Anyway, on reflection it’s easier to do this as html in a text box – easier to reorder. Thanks again for your help and interesting widgets.
@Constantin: You are missing the widgets plugin, please check the install notes from the framework.
@bodsham: Please check your sidebar. there is some wrong html in there -> get yourself this firefox plugin to check your sourcecode:
http://users.skynet.be/mgueury/mozilla/
For some strange reason with King Categories I get one category alone indented each time. i have tried deleting it and recreating it but this category always comes up with the same indent – style=”margin-left:1em. None of the others have it. I’m baffled. http://davidhewson.mydaisy.info/
I uploaded the King Widgets Framework, then the King Categories, but when I’m trying to activate the plugin I get an error message:
Warning: widget_king_categories_register(widgets.php): failed to open stream: No such file or directory in /wp-content/plugins/king-categories.php on line 471
Warning: widget_king_categories_register(): Failed opening 'widgets.php' for inclusion (include_path='.:/usr/local/lib/php') in /wp-content/plugins/king-categories.php on line 471
Am I doing something wrong? Thank you!
Hallo Schorsch,
wollte nur mal checken ob du deinen Chinaurlaub gut ueberstanden hast und wie der Stand der Dinge ist wegen dem King Pages.
vielen Dank im Voraus
Alex
Ach echt!? ist ja genial, du treibst die Spannung ja in die Hoehe
. Waere super wenn du das plugin bald released. wollte meine Webseite liebend gerne fertig haben, bevor ich nach Deutschland zur WM fahre.
Viel Spass noch in Peking
Vielen Dank im Voraus
Alex
@alex: king-pages habe ich schon wie von dir gewuenscht fertig, aber noch nicht released. es muss j noch ein wenig spannung bleiben
greatings aus peking
Hallo Schorsch,
ich kann mich den anderen nur anschliessen, echt ne super Sache deine plugins, Ich habe auch King Category Menu eingesetzt, funzt auch wunderbar, der einzige Hacken, meine Untermenues werden nach links versetzt angezeigt, nicht nach rechts. Irgendeine Idee? Auf das Feature “show a Category menu only under a given Category” freu ich mich auch schon, aber ich goenn dir ja auch den Urlaub.
Noch ne Frage haette ich, ist es auch moeglich ein widget fuer “Pages” zu machen. Das jetzige vorhandene Widget zeigt leider alle Pages auf einmal an. Waere super wenn man da auch eine Option haette, wo Pages nur auf bestimmten pages angegeben waeren. Waere toll wenn du da auch ein Widget rausgeben wuerdest.
Schoene Gruesse aus den sonnigen Texas
Alex
bin bis zum 6.6 im urlaub danach schauen wir mal
Zitat: Comming Features
- Option to show a Category menu only under a given Category. Very usefull if you have deeply nested Categories… if you need this urgendly write me because it´s nearly finished /zitat
darauf freu ich mich schon…. steht schon ein veröffentlichungsdatum fest?
1. set the default switch for the start.
2. slowly digg your way throught the switches.
3. use the debugging output ->if you are using king-text you could use it´s PHP feature to insert the list_cats() call with the debugging output manually.
4. check the Wp-Codex for list_cats() to better understand the Options and switches. There are some options that don´t work with each other.
5. maybe there is a conflict between two widgets so you could dragg some widgts temp. off the sidebar, to make sure.
6. if it still won’t work you can write me an email and provide me with a temp. login so i can check if it is a problem with the widget. Since my widgets very diverse you can imagine that i can´t test all possible combinations of all widgets. So i need this kind of feedback.
First, I want to say that I love King Text–it drives my entire sidebar.
Sadly, I’ve never been able to get King Categories to work. Even with them enabled, it won’t show the hierarchy, children, li markers…nothing. I have the foldable navigation enabled and that plugin activated and that feature doesn’t work either.
Yes, when your widget is operating it does show up and shows the title and all top parent categories, but that’s it.
No idea how to fix this. I recently updated to 8.5 and that fixed nothing. I’ve reset the cache and tried re-installing everything, but nothing makes the features of the King Categories widget work.
Any ideas?
OK, I got it now. And I can use it that way.
Thanks,
Yes you are misinterpreting this switch in the advanced features! This determines which template is used to show the article-listing.
You can find the full documentation in the wordpress codex
The whole “Where to show”-Menu is not yet implemented in king categories.
I’m trying to use King Categories for a category listing only on the main page using file=index.php. The setting seems to change as I change the file name, but categories show up regardless everywhere.
I thought the categories could be set for pages, for example, by using the file=page.php, which I use for pages.
Debugging shows the name is actually getting changed, but nothing happens as a result.
Any clues? Am I misinterpreting something?
Thanks
Danke für die Antwort.
Aber das ist mir leider zu hoch; ich wüsste gar nicht, wo ich da ansetzen muss. Ich werde mich damit behelfen, die IDs manuell zu ändern; es sind ja nicht so viele.
Vielen Dank nochmal für Dein Plugin und alles Gute,
Peter.
@peter:
king categories nutzt nur die möglichkeiten des list_cats() aufrufes. wenn du diesen erweiterst (so wie z.B. der dropdown categories plugin) kann ich ein weiteres sortierfeld einfügen. vorher macht das keinen sinn, da list_cats() leider nicht zu einer anderen sortierung fähig ist.
Eine super Sache, dieses Plugin.
Was ich noch bräuchte, wäre jedoch die Möglichkeit, die Kategorien sortiert nach einer eigenen Reihenfolge auszugeben. Man könnte eigentlich das Beschreibungsfeld dafür “missbrauchen”.
Wie könnte man nun im Kind Categories Plugin die Sortierreihenfolge so festelegen, dass zusätzlich (oder statt) ID und Name das Beschreibungsfeld anwählbar wäre?
Vielen Dank im voraud für jegliche Tipps.
Peter.
no, this widget is basicly just generating the list_cats() call and has no influence on the category count intelligence.
One of the problems with list_cats() is that it counts scheduled posts in the post count (a post scheduled to appear in the future that is not visible yet in the category still is counted in post count). I believe this bug has been submitted to WordPress, but we have to wait until who knows when to get a fix. Any chance your widget can override this bug and show the correct post count?
oh sorry für das englisch. aber die plugins stehen natürlich nicht nur der deutschen community zur verfügung. Da ich mir nicht die doppelte arbeit machen will, was das übersetzen angeht, bleibe ich bei englisch. ich bin übrigens der einzige und mache das nur bei artikeln die “international” angesurft werden.
Ein widget beinhaltet code der normalerweise ein teil einer seitenbox ist. also z.B. navi elemente oder die suchbox. es kann aber auch je nach Layout an irgend einer anderen stelle im template untergebracht werden(Header, footer, content..)
sehr feine sache. da werd ich dann doch neugierig was sich hinter dem wohlklingenden fremdwort widgets verbirgt. sieht gut aus!
ich les jetzt schon ein paar artikel (structured micro blogging, etc…) und muss mich nur wundern, dass ihr (alle?) auf englisch schreibt, vermutl. nur weil es sich halt nicht so flüssig liest… hat das einen besonderen grund? oder sprechen medial-schaffende :-O alle so (englisch)?
ps: aber bitte bitte baut euch mal ein king_spellchecker (mit einer king_rechtschreibung.mo) natürlich
hrhrhr … nevermind the klugscheissers
I went in and hacked my widgets.php to show the RSS icons, but this is much nicer, and will survive when they update the widgets plugin. Thanks!