Subscribe via

Alex King’s “Articles” Plugin Mod

Alex King’s ‘Articles’ is a great plugin that lets you easily mark posts as featured articles. You can also display a list of featured posts on a selected page/post by placing a “&#35&#35&#35articles&#35&#35&#35” tag in it. That said, there are TWO big problems with it:

  1. It doesn’t work with WordPress 2.3.x or 2.5.x
  2. It displays the same article in each category that the post is listed under. So that means if your featured post is filed under 5 categories, your post will show up 5 times on your featured articles list.

Andy Cowl has already resolved issue #1 on this WordPress support thread (THANK YOU!). Here are the changes Andy Cowl did.

+++ articles.php        (working copy)
@@ -96,13 +96,11 @@
        $cats = $wpdb->get_results("
                SELECT $wpdb->term_relationships.object_id, $wpdb->terms.term_id, $wpdb->terms.name, $wpdb->terms.slug
-               FROM $wpdb->term_relationships
-               LEFT JOIN $wpdb->terms
-               ON $wpdb->term_relationships.term_taxonomy_id = $wpdb->terms.term_id
-               LEFT JOIN $wpdb->term_taxonomy
-               ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
-               WHERE $wpdb->term_relationships.object_id IN (".implode(',', $post_ids).")
-               AND $wpdb->term_taxonomy.taxonomy = 'category'
+               FROM $wpdb->term_relationships, $wpdb->term_taxonomy, $wpdb->terms
+               WHERE $wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id
+               AND $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id
+               AND $wpdb->term_taxonomy.taxonomy = 'category'
+               AND $wpdb->term_relationships.object_id IN (".implode(',', $post_ids).")
                ORDER BY $wpdb->terms.slug, $wpdb->term_relationships.object_id DESC
        ");

On issue #2, I’m thinking about modifying this plugin to accept another custom field called “article_category” to accept a string value of your category slug. Let’s say you feature a post that has 5 categories and set “article_category” custom field to “blogging” then the post will only show up once under the “blogging” category on your featured articles page. What do you guys think of this mod? If there is some demand for this, I will definitely move this to the top of my stack of projects and crank this out in a few hours. Please let me know via comments.

2 Responses to “Alex King’s “Articles” Plugin Mod”

[go to last comment]
  1. I would love to have this plugin. Featured posts is getting mainstream for blogs and it would really be nice if you could develop this. Similar to the one implemented by JohnChow?

  2. r00n

    great that people are taking care of this. I would like this plugin as well, but now it creates one big mess on my website!

[go to first comment]

Leave a Reply