Demystifying Betting Myths
Statistics are the language of betting; learn to speak fluently, and the market will reveal its secrets.

Experience the future of sports betting education at our new store – visit Soccerwidow's new store!

WordPress Plugin: List Category Posts


This plugin List Category Posts has reached almost 400,000 downloads in less than 4-years (up to 28/03/2013 as I write this update), which is always a good sign of a valued plugin.

I have to say that the plugin works perfectly in a range of positions such as sidebars, within posts, etc., and personally I think it is a really great piece of work.

Update 5.9.2011: Since I wrote this article, the plugin has been revised by the programmer and now works ERROR-FREE! I use this plugin almost everywhere: in the sidebar, in articles, etc. The plugin is a great contribution to the functionality of WordPress.

The programmer is Picando Código and according to its description the plugin provides pretty much everything that one could hope for:

  • name – To display posts from a category using the category’s name
    Ex: [catlist name=mycategory]
  • id – To display posts from a category using the category’s id
    Ex: [catlist id=24]
  • orderby – To customize the order. Valid values are:
    • author – Sort by the numeric author IDs
    • category – Sort by the numeric category IDs
    • content – Sort by content
    • date – Sort by creation date
    • modified – Sort by last modified date
    • title – Sort by title
  • order – How to sort orderby. Valid values are:
    • ASC – Ascending (lowest to highest)
    • DESC – Descending (highest to lowest)
      Ex: [catlist name=mycategory orderby=title order=asc]
  • numberposts – Number of posts to return. Set to 0 to use the max number of posts per page. Set to -1 to remove the limit. Default: 5
    Ex: [catlist name=mycategory numberposts=10]
  • date – Display post’s date next to the title. Default is ‘no’, use date=yes to activate it
  • author – Display the post’s author next to the title. Default is ‘no’, use author=yes to activate it
  • excerpt – Display the post’s excerpt. Default is ‘no’, use
  • catlink – Show the link to the category. Use the template system to customize its display using the variable $cat_link_string. Default is ‘no’
    Ex: [catlist catlink=yes]
  • comments – Show comments count for each post. Default is ‘no’.
    Ex: [catlist comments=yes]</li>

Sounds too good to be true, yes..?

At first sight the plugin functioned perfectly well and published a list of articles of the desired category within another article, although I needed a while to discover where I could find the Category ID, but then eventually with [catlist id=xx, yy] (xx, yy – the ID’s for the appropriate categories), a beautiful list materialised showing all articles in their appropriate categories.

However, it was not entirely clear to me why the settings could only be adjusted in a widget? As I had to activate the widget in my side bar the comments facility then appeared on each page of my blog and as soon as I took the widget out, everything reverted back to the default settings.

Okay, if this was the only negative I could live with it and if you only want a simple list in one or two articles, then this plugin is probably ideal for that purpose.

However, my challenge was that I wanted to give titles to the lists (the category to which the articles belong). In accordance with the description of the plugin this should be possible but no matter how and where I inserted [catlist id=xx catlink=yes], it did not work!

Of course the category title can be inserted manually into the post and also the link but this means if you change your mind at some stage in the future and rename the category you have to be very organised and remember each and every post which then needs to be amended. Therefore, I wanted to get the category names from the category ID and display them as titles.

According to the description of the programmer this should have been possible and I spent a whole day surfing the Net and reading various forums in an attempt to find out what I did wrong.

After searching for perhaps 10 hours I came across the following article: Plugin List Category Posts – Sharing my own template in LCP. Chocolaterebel had the same problem and in his/her article refers to numerous bugs and errors in the plugin. I began looking closer at the php-files and pretty soon came across many other problems with the code…

For example:

  1. list_cat_posts.php
    99 if ($cat_link_string! = '') {
    90 $lcp_output = “>p<>strong<”. $cat_link_string. “>/strong<>/p<”;
    91} else {
    92 $lcp_output = '';

    If $cat_link_string is set to nothing (”) then nothing is exactly what will be shown; the variable must be either “no” or “yes”. No wonder I had problems!

  2. The file template/default.php contains the information for how the category is to be displayed but is not activated in list_cat_posts.php:
    26 *
    27
    28
    29 include (“list_cat_posts_widget.php”);
    30
    31/**

    Thus, I changed line 30 to include template/default.php

    The difficulties of programming were immediately revealed to me...

  3. WordPress announced a fatal error in template/default.php in the lines 36 and 37, which led to a complete breakdown of my entire site:
    36 foreach ($catposts as $single):
    37 $lcp_output. = “>li<>a href= "”. get_permalink ($single /a<”;


I was unable to get back into WordPress and therefore could not deactivate the faulty plugin. This meant logging into the ftp server to delete template/default.php.

Now, I gave up as it all became a little too 'advanced' for me. I am not a programmer. Certainly, I could have spent another 24-hours acquiring more knowledge but having already found three errors in this plugin there were probably more still...

At the time I also tried the code which Chocolaterebel provided, but error messages appeared and WordPress deactivated the plugin automatically.

I eventually de-installed the plugin List Category Posts and sought another solution to include a list of articles of a category in another article using the category ID allowing display of the category title as well.

List Category Posts Plugin Summary

Is this such a good plugin after all? Well, long after my original strife the problems with it seem to have been fixed, and since this article was written in January 2011 (when the plugin had reached 89,000 downloads), another 310,000 users have downloaded it.

The big lesson I have learned over the years of working with WordPress is that you need to appreciate that many plugins are 'works in progress' and that there are usually plenty of alternatives available to solve problems or satisfy requirements.

Finally, I must express my gratitude to the following important articles and descriptions on how to insert HTML and php codes for publishing in a WordPress post without WordPress or the browser translating the code:

  1. How To Display PHP Code Directly in WordPress Posts | Ben O'Sullivan
  2. Displaying Code In WordPress PostsHow | ThemeLab

For replacing < with &gt; and > with &lt; I copied and pasted the code into a Word document and then carried out the changes using 'Find and Replace' and then copied back. A separate plugin as recommended by ThemeLab is not necessary.


Last Update: 10 January 2011

Categories:Website Business Wordpress Tips



4 Responses to “WordPress Plugin: List Category Posts”

  1. 12 February 2011 at 4:29 pm #

    I’m in the middle of developing a WP multisite network, and I’ve network-activated the plugin List Category Posts. I wanted to use it to call in posts from different categories to targeted sections on the home page (apart from the main blog section), and this was possible to do by creating pages, inserting the appropriate catlist shortcode, and then using php code to call the page into the targeted sections on the home page. It works very well, for my purposes, and behaves just according to the parameters set within the shortcode, with one exception – it is not calling the thumbnails along with the posts. But I confess that I have not identified the hangup: it is possible that it is a problem unrelated to the plugin. Fernando has also updated the plugin to correct the path to the template files from STYLESHEETPATH to TEMPLATEPATH, since the former sends the plugin looking for a template inside the child theme’s folder whereas the templates are supposed to be located inside a folder inside the parent theme. (The correct call to the parent theme’s folder is TEMPLATEPATH.) So I’m one happy List Category Posts user.

  2. 16 January 2011 at 11:55 pm #

    Don’t worry I didn’t feel offended, I understand you. I myself have felt frustrated with software several times, but it’s ok as long as we recognize the effort developers invest in coding.

    Now, thanks to your post, I realized the catlink parameter was not working, so I fixed it on version 0.14.1, so thanks for that!

    Regarding the misleading descriptions of the plugin, could you please let me know which parts you consider misleading? It may happen that something breaks on an update, but I think there’s nothing there the plugin doesn’t actually do.

    About the “finished version” of the plugin, there’s a wise saying that goes: “Software projects are never finished, they are abandoned”
    The version number of the plugin shows the 1.0 (generally considered stable release) hasn’t been reached yet.

    Anyway, never mind, sorry for the trouble you went through with the plugin, hope you changed your mind at least a bit about it 🙂

    Regards!

  3. 16 January 2011 at 5:42 pm #

    Hi Fernando,

    I apologize should my review have offended you, I certainly didn’t mean it. On the contrary I’m very grateful to all you guys who are constantly developing new plugins and all this open source software because without this input amateurs like me would never be able to have their own website.

    However, what I would recommend is that you take out the misleading descriptions, and be honest about the things the plugin can do and cannot do. I certainly would have found it beneficial if somewhere I would have read that the plugin is not finished yet, and that you do it as a hobby, and that the plugin is still being maintained. and you are not “not even strong with PHP coding” – all this stuff.

    Then I would not have expected a perfect working plugin and saved myself one and a half day trying to fix something far beyond my skills.

    Greetings to Uruguay,
    Soccerwidow

  4. 16 January 2011 at 4:30 am #

    Hi, I’m the developer for List Category Posts.

    The plugin started as a short script I used for my personal blog two years ago. I decided to submit it to WordPress because I thought someone else might find it useful. Apparently more than a thousand WordPress users did. Not 89.000, since that’s the total number of downloads. And every new version download counts, even if it’s from the same user.

    Anyway, people started asking for new features, so I started adding them whenever I had some free time as a hobby. And that’s how the plugin is still being mantained. I’m not even strong with PHP coding, this is the only PHP coding I do at all.

    Whenever I do an update, I generally hack in the new functionality and sort of test in on my blog, but don’t really have a professional development environment around it. It’s just a hobby for me, and since I’m not charging for it, I guessed people would understand this. Also, this is free software, you are free to modify and redistribute this software as long as you respect the GPL.

    Knowing this, the plugin has had a lot of code contributions and fixes from different users. There’s some old code which hasn’t been revised like the one you mention on your first example. This will be fixed on the next release.

    But the second example don’t really make sense. The default template file is for users to take as an example.

    If you check the code, there’s a couple of To-do’s before I release a 1.0 version, which would mean I consider the plugin “stable and complete”. I’m on version 0.14 now, and I’m not really sure when 1.0 will be reached. But simplifying the template system to make it user friendly. Something like a short code or WYSIWYG editor for the users to have a pretty simple way to use the plugin as they like.

    Haven’t had time to implement this. As I said, this plugin is a hobby for me, but I do take in consideration user feedback and code contributions for it’s development.

    Hope I get to a 1.0 version soon, so that you can try the plugin again, see if it works for you then.

    Regards
    Fernando

Leave a Reply / Comment

Notify me of followup comments via e-mail. You can also subscribe without commenting.