Wordpress Themed Categories Plugin

Posted by Mike Lopez under Downloads
Oct 2006
17
05:02am


This plugin works with Wordpress 2.3.3 and Wordpress 2.5

Update: After a long time, I finaly had the chance to update and fix the bugs in the plugin. From v0.1b, I can now say that it’s a true v1.0. This should work with the latest versions of Wordpress now. Just overwrite themed-categories.php with the latest version and you’re all set.

2008-04-24: Fixed the redirect bug. Plugin no longer needs to redirect now.

Download Themed Categories Plugin v1.0

Introduction
I had to create my first wordpress plugin due to necessity. One of my clients require that he be able to assign different themes for each category. I have seen this feature in the Wordpress Subdomain Plugin but I can’t use it as is since my client doesn’t want his categories to be subdomains. I looked at the code of said plugin and said to myself, “heck, this is easy.”

Inspired by the subdomain plugin, I decided to write my own plugin learning from both actual code and the wordpress plugin API. In approximately 4 hours, I was able to come up with my very first Wordpress Plugin and I love it! Hehehe.

Introducing, the Themed Categories Plugin. It’s in its early stages so I will be glad if any of you can help me improve it. With it, you can assign different themes to each of your wordpress categories.

How to Install
To install it, just download the file, unzip it to your wordpress plugins folder and activate it.

How to Use
To use it, simply go to Manage->Categories, edit the category you wish to assign a theme to, select the theme from the “Select category themed” dropdown, and save it.

Disclaimer
Lastly, I haven’t tested this extensively but it seems to work fine under Wordpress 2.0. I have no plans of testing it in Wordpress 1.5 so please don’t bother me if it doesn’t work there. After all, it’s easier for all of us to simply upgrade to 2.0.

Thanks! Post your comments and bug reports below.



48 Responses to “Wordpress Themed Categories Plugin”

  1. jong Says:

    nice, I’ll try to test it later. I havent tried creating my own plugin but i wanted to. hehe maybe if i’ll have more time, yeah that’s after school. Anyway, kudos to you for this uber nice plugin..

  2. Ruben Says:

    Thanks from Barcelona, Spain :)

  3. MIHO Says:

    Thank you from Japan;)

  4. Eleesha Says:

    I want to congratulate you for creating this plugin. I was looking for something like this for my Wordpress 2.0 install as I just wanted to include a different template for each of my niche categories. I did loads of searches looking for the solution and just as I was about to give up on ever actually being able to achieve this - without having to write or change loads of code - I eventually came across your blog with your plugin. Thankfully, it worked great, it was simple and straightforward to install. Well done and keep up the good work and thanks again :-)

  5. Matt Says:

    Has anyone had any success with this plugin under WP 2.1? It’s not working for me…

  6. David Petersen Says:

    I just tried to use it on 2.2.1 and I don’t get a select theme dropdown in the Edit Category menu.

  7. Takuya Says:

    It was working fine until today, all in sudden my site got offline due to this plugin. There’s definitely a problem with WP 2.x series when WordPress automatically tries to save posts, this plugin conflicts with it, and causing the site to down.

    Perhaps shutting down auto save on 2.x series would work well.

  8. Jim McMenamin Says:

    Mike,

    Great template, but I was hoping you could give me a hand. I’m trying to set up the template for some of the niche sites I’m working on, but for some reason I can’t get the adsense to display properly on my home page.

    It comes up correctly on the other pages that I’ve created on the subdomain, but on the main page I only get adsense related to blogging tools, wordpress, and various templates. On this particular one I’m trying to come up with car insurance related ads, but it isn’t happening.

    Any suggestions on how I can address this?

  9. The Blogger Says:

    Hi Jim McMenamin,

    I experienced that before. Just wait for Google to properly index your site. In my previous experience, it took I think almost 10 days before the right ads started showing up. For now, just keep on updating your site with content.

    Mike

  10. lordbarron Says:

    ive been looking for somehting like this, my php is weak so this really has helped me out! thanks.

  11. dreamer Says:

    Oups !!! i have an error msg :

    Erreur de la base de données de WordPress : [Table ‘discussi_blogddg.wp_themed_categories’ doesn’t exist]
    SELECT cat_theme FROM wp_themed_categories WHERE cat_ID = 9;

  12. The Blogger Says:

    try disabling then re-enabling the plugin. also what version of wordpress are you using?

  13. Malta Says:

    Cool, will definitely try it out. Thx :)

  14. Griffin Says:

    Hi! So does this work in 2.3 or 2.3.1??? Has it been updated recently?

    ~G

  15. The Blogger Says:

    haven’t tried it yet. :(

  16. Margje Says:

    Great plugin, searched a long time to find it …..

    but….

    it does not work with wp 2.3 and 2.3.1 :(

    The install is no problem
    The dropdown menu is ok, and i can choose a theme also….

    But the selected theme does not shows up in the selected category….

    I (we) will appriciate an update!

    Thanks in advance and keep it up!

  17. Kalle Says:

    Great work, thanks.
    I run WP 2.3 on a Blog I administrate. There I had to patch Your plugin a little to work.
    I appended the “ignore case option” for the categories page the regexp to look like this: “operatestr = operatestr.replace (//i, substitute+”");”. Then the DB structure changed a bit. Don’t know it exactly but a first look brought me to the following SQL for the function tc_template_redirect in the is_single block: “$cat_id = $wpdb->get_var (”select {$table_prefix}term_taxonomy.term_taxonomy_id from {$table_prefix}term_taxonomy, {$table_prefix}term_relationships where {$table_prefix}term_taxonomy.term_taxonomy_id = {$table_prefix}term_relationships.term_taxonomy_id and {$table_prefix}term_taxonomy.taxonomy = ‘category’ and {$table_prefix}term_relationships.object_id = {$wp_query->post->ID} LIMIT 1″);”. This works for me now. If You have any suggestions please let me know. Every comment is welcome! You may want to download my little changes from http://www.gschmarri.org/wp-content/uploads/plugins/themed-categories-23.zip for a while.
    cu
    Kalle

  18. Kalle Says:

    Ups? Where has gone my comment?
    Wanted to point out one more thing. is_category changed also in WP2.3 I think. So I had to replace “$cat_id = $wp_query->post->category_id;” with “{ $cat = get_the_category(); $cat = $cat[0]; $cat_id = $cat->cat_ID; }”.

  19. noirlecroi Says:

    great great great! anyone been able to resolve the issue of the changed category theme not carrying over when looking at individual posts in the category

  20. sam Says:

    same question s noirlecroi’s last post, anyone figure out how to keep post pages in category to same theme as category theme?

  21. Kevin Says:

    Would LOVE a published update of this theme! Thank you so much.

  22. kapaeru Says:

    Oups !!! i have an error msg :

    WordPress database error: [Table ‘pithecanpodpus.wp_themed_categories’ doesn’t exist]
    SELECT cat_theme FROM wp_themed_categories WHERE cat_ID = 3;

  23. The Blogger Says:

    Hello to all… Please download the latest version of this plugin now. I fixed the bugs and it should now work with the latest versions of Wordpress. Sorry for the long delay, I got really busy. Cheers!

  24. Hans Says:

    Hi,
    your Themed Categories Plugin is great for me…
    I can apply different themes to different CATEGORIES… ok is simple and nice…
    but i would ask you if was possible to have a plugin for apply different themes to different PAGES…

  25. The Blogger Says:

    Hi Thanks for giving it a try. As for different themes for pages, I’m sorry but I don’t have such a plugin.

  26. nils Says:

    cool! thanks a lot! u made my day :)
    nils

  27. Louis Says:

    Hi,
    Can anyone confirm if the latest version works with WP 2.5? Thanks!

  28. The Blogger Says:

    Hi,

    Just tested it with Wp 2.5 and it works fine. The theme selection dropdown appears when I edit a category.

    Mike

  29. Louis Says:

    Hi,

    I can also see the theme selection dropdown here. However, the changes are not saved (after I select a theme and click edit category), because the plugin does not seem to have any effect?

  30. The Blogger Says:

    Hi Louis,

    To test the plugin, I installed Wordpress 2.5 here:

    http://mikelopez.info/wp25/

    And created two posts - each on a different category.

    Unthemed: http://mikelopez.info/wp25/?p=1
    Themed: http://mikelopez.info/wp25/?p=3

    The categories are at:

    Unthemed: http://mikelopez.info/wp25/?cat=1
    Themed: http://mikelopez.info/wp25/?cat=3

    Seems to be working fine. Cheers!

  31. Colorfulmars Says:

    Hi I ve just tried this plugin but I can’t find the “Select category themed” dropdown tag? Where is it? I am using WP 2.5 …

  32. Mike Lopez Says:

    Hi,

    It only shows when you “edit” a category and not when you “add” a category.

    Mike

  33. Louis Says:

    Hi,

    Thanks. On a hunch, I tried out the plugin on another WP2.5 installation and this time the plugin does exactly what it is supposed to do! So I think the problem must be to do with this particular instance of WP2.5 and perhaps incompatibilities with other plugins? Anyway I will try to get to the bottom of this . Thanks again, and an excellent plugin, if I can get it to work on the original domain I was asking about.

  34. Louis Says:

    Hi again,

    It turns out the table themed_categories (defined in tc_install) were never created for some reason in my case. After manually creating the table using phpmyadmin, everything is working fine now.

  35. Chris Says:

    Hey all,

    I love the plugin, but I’m running into one problem.

    I, like a lot of people, use Feedburner for syndication. When Themed Categories is activated, the Feedburner feed returns a 500 error stating the server redirected too many times.

    Has anyone else run into this, and if so how did you fix it.

    WP2.5, by the way.

    Love the plugin; I just wish I could use it. :)

  36. Chris Says:

    Follow up:

    I’m finding the plug-in is killing my rss feed altogether, ignoring Feedburner.

    Any help would be appreciated.

  37. Chris Says:

    Hi, again.

    Just wondering if anyone (or perhaps Mike since he knows the plugin better than all of us) has seen the 500 redirect error and has found a way to work around it.

    I’m finding the error isn’t just feed related — it’s a general 500 error that prevents even things like posts in a themed category from being dugg.

    Thanks!

  38. Mike Lopez Says:

    Hi Chris,

    Thanks for reporting the problem. There was some old code in the plugin causing the redirect - back then, it was the only way I know to make the plugin work but experience change people often times making us better. :)

    To make the long story short, I’ve fixed the bug and updated the plugin. You can download the latest version now and see if it works on your end.

    Mike

  39. Jed Says:

    This will be a replacement of WPMU to seperate the content however there is a plugin out there that has not been updated. It would be based on single file to modify different template instead theme. Is it possible for you to have another plugin for template based on category instead I have to copy the whole theme and redesign one page of header to make it look differently. I just dont want the different theme but template, yes…

  40. Roy Sencio Says:

    Hi Mike… interesting plugin you got there.

    Is there a plugin that allows me to choose what to display on the sidebar, for both pages and posts? Like say, for posts I want to show only recent posts or other posts on the sidebar, but on a page, I want to display just categories and no recent posts.

    Thanks,
    Roy

  41. Mike Lopez Says:

    Thanks Roy. As for what you want, I don’t know of any such plugin yet but that sounds interesting.

    Mike

  42. Blond Says:

    Well you guys…if you wonder if the plugin works for WP2.5. It really does. I installed it and use it on my website. But its not actually what I looked for - I was searching for a plugin that can change the header per category. For now I will use it. This plugin rocks - I love it. Thanx man - thumbs up from south-america.

  43. jocuri Says:

    thanks.

  44. srcasm Says:

    I installed this plugin on one of my blogs — 1459pm.com and none of the pages would load. It would just sit there an spin. Anyone else see this issue before? WP 2.5.1.

  45. Mike Says:

    Hi Mike,

    I have just installed your plugin on Wordpress 2.5 but the dropdown is not appearing.

    I have done some checking and the problem seems to be the following javascript error on the edit category page:-

    error: ‘document.forms[0].tc_cat_theme.options’ is null or not an object.

  46. Michael Says:

    Hi Mike,

    I have just installed your plugin on Wordpress 2.5 but the dropdown is not appearing.

    I have done some checking and the problem seems to be the following javascript error on the edit category page:-

    error: ‘document.forms[0].tc_cat_theme.options’ is null or not an object.

    Any advice would be greatly appreciated.

    Best regards,

    Michael

  47. Mike Says:

    Hi again Mike,

    Some of my comment went missing when I submitted it.

    The full error was:-

    message: Statement on line 15: Could not convert undefined or null to object document.forms[0].tc_cat_theme.options[0] = new Option(” (global)”, ” (none)”);

    Hope this submits ok.

    Best regards,

    Michael

  48. televiziune online Says:

    awesome plugin thank you

Leave a Reply