Categorized under: Wordpress Plugins

Top Categories Plugin

I created a new wordpress plugin called Top Categories. You tell it how many of your most frequently posted to categories you want it to show and it will display an unordered list of those categories. It is based off of the Popular Tags plugin by Theron Parlin which was based on the weighted categories plugin by Matt Kingston. Unlike either of those plugins I do not display a tag cloud – but that might be a good option so that this one plugin is a bit more flexible.

You can get this plugin downloading this zip file. Usage is pretty simple:


<?PHP top_categories(10); ?>

You can replace 10 with any positive number you want. By default top_categories() will show the top ten categories. This plugin may work with wordpress versions before 2.0 – but I haven’t tested it.

Comments

  1. Hi,
    I have a question about ISNULL( expreesion, replace value) in T-transaction SQL,
    I use SQL server’s Query Analyzer to execute a Selection query with ISNULL, but
    the replcae value doesn’t replace the NULL.

    Do you know the reason? Appreciate in advance.

    Hang Lu


    Hang Lu
    March 1st, 2006
  2. Hang,

    I’m not sure why you posted this question on my post about my plugin – but sure I can help.

    First I’m pretty sure the replace value has to be of the same type as the column that is null.

    So lets pretend you create a table “mytable” with a column “test_column” which is of type varchar(50) which allowed NULL values

    if you created five records in this table like so

    id: 1
    test_column: NULL
    id:2
    test_column: 'something'
    id:3
    test_column: 'another thing'
    id:4
    test_column: NULL
    id:5
    test_column: NULL

    If you wanted to select all the columns and replace nulls with the string “NOTHING” you would run the query:

    SELECT id, IsNull(test_column,'NOTHING') FROM mytable

    you would get the results

    1 'NOTHING'
    2 'something'
    3 'another thing'
    4 'NOTHING'
    5 'NOTHING'

    I just tested this in Query Analyzer and it worked fine.

    Another thing that might cause problems is if you don’t have a null value but an empty string in the column.

    Hope this helps
    Bill


    Bill
    March 1st, 2006
  3. Is your plugin compatible with the new 2.1 release?


    Tom
    January 30th, 2007
  4. Tom I believe it is. I run a hybrid version of wordpress on this site (I download development copies on occasion from the wordpress site and it still works ok here.

    I’ll update my test copy (on my machine) to the latest possible nightly build and see if it still works then post back here to let you know.


    Bill
    January 30th, 2007
  5. Tom – yes it does seem to work fine in the newest version of WordPress.


    Bill
    January 30th, 2007
  6. Hi,
    How to excude some categories from the list? Thanks!


    Jakub
    February 26th, 2007
  7. Jakub,

    currently you can’t exclude any; I’ll look and see how hard it would be to add that feature. Previously I have never needed to exclude any so it just displays the top categories you post to. Would you want to exclude them by category name?


    Bill
    February 26th, 2007
  8. [...] Top Categories: Tell it how many of your most frequently posted to categories you want it to show and it will display an unordered list of those categories. [...]

blog comments powered by Disqus
RSSSubscribe to my feed now.