Advanced Category Excluder (ACE) plugin for WordPress

For a couple of days I was looking for a plugin for my blog, that can hide some categories, form the front page. After I discovered, that I need to hide them as well from the RSS feeds. And after I’ve figured out that what I want a plugin that I can control categories to be displayed or hidden, in different parts of the blog.

For example I’m planning to write technical articles in english. But I’m writing my blog in hungarian… And maybe most of people who are reading my blog won’t be interested in such technical subject, but those who are using my blog’s RSS feed maybe interested in technical articles.

So I’ve written a plugin for WordPress that can solve the problem mentioned above.
This plugin was written from scratch, but it has been inspired by Front Page Excluded Categories Plugin by Sean O’steen and Jason York.

Download here(1 Kbyte ZIP)

Details:

  • controls which category would appear in which part
  • handles empty categories
  • hides BlogRoll from category list
  • support for Event Calendar
  • works with WordPress 2.1, 2.2 and 2.3

Hasonló bejegyzések

30 Hozzászólás

  1. Harder | 2007 07 20 | Válasz

    Alapból 2 külön blogra kéne tenni a tartalmat. :P A személyes és a technikai tartalmat – ha ez többször is elő fog fordulni, főleg eltérő nyelveken – nincs értelme összekeverni.

  2. DjZoNe | 2007 07 21 | Válasz

    Ez nem látszik a főoldalon. De RSSben bent hagytam.

  3. Nice from Thailand (SE7ENize.com) | 2007 07 25 | Válasz

    This is what I’m looking for! Thanks for great plugin. :D

  4. New To this | 2007 07 30 | Válasz

    I’m pretty new to WordPress but this exactly wha tI am looking for. I have installed the plugin – and activted it- but I can’t see where in the dashboard that this plugin appears – where is that?

  5. lila | 2007 09 03 | Válasz

    Thanks for this plugin. It was what I was looking for!
    for those that are looking from where to set up this plugin, I’d suggest to have a look under Options- ACE!
    Regards

  6. Dave | 2007 09 06 | Válasz

    Dude, brilliant! This is just what I was looking for to make my WordPress site work the way I wanted. Thank you.

  7. jameswillisisthebest | 2007 09 08 | Válasz

    This is my first post
    just saying HI

  8. memoxxxx | 2007 09 11 | Válasz

    Hi! excellent plugin! but, i get this message when I try to use it on my blog:

    WordPress database error: [Not unique table/alias: 'wp_post2cat']
    SELECT SQL_CALC_FOUND_ROWS distinct wp_posts.* FROM wp_posts LEFT JOIN
    wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) LEFT JOIN
    wp_categories ON (wp_post2cat.category_id = wp_categories.cat_ID) LEFT
    JOIN wp_post2cat ON wp_post2cat.post_id = wp_posts.ID WHERE 1=1 AND
    category_id IN (3) AND (post_type = ‘post’ AND (post_status =
    ‘publish’ OR post_status = ‘private’)) AND wp_post2cat.category_id NOT
    IN (18) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 1
    :( Can you help me?

    Thanks in advance.

  9. Alex | 2007 09 23 | Válasz

    Nice plagin:-)

  10. DjZoNe | 2007 09 24 | Válasz

    memoxxxx, it has been fixed in version 1.0.1.
    Thank you for you, and other reporters :)

  11. Faro Viejo | 2007 09 25 | Válasz

    I upgrade my blog to wordpress 2.3, but this plugin (version 1.0.2) dont´work :-(

    how would i can fix this problem ?

    Thanxs

  12. Rirath | 2007 09 26 | Válasz

    1.0.2 indeed seems to be not functioning correctly on 2.3. Seems to have no effect at all.

  13. DjZoNe | 2007 09 26 | Válasz

    If you give a detailed bug report I’ll see what can I do about it.
    My blog is running under WP 2.3 and works perfectly for me.

  14. Sean O'Steen | 2007 09 26 | Válasz

    I think I have the fix for your plugin. On Line 41, the WHERE clause compares wp_term_relationships.term_taxonomy_id to your list of categories when it should probably be comparing the wp_term_taxonomy.term_id field.

    Thanks,
    Sean

  15. Sean O'Steen | 2007 09 26 | Válasz

    Hmmm, maybe not. It worked in the ‘front page excluded categories’ plugin. I’ll need to get my head wrapped around the control panel code and the ‘get_categories’ function.

  16. Jim Hinds | 2007 09 27 | Válasz

    Sean is on the right track. The category numerical equivalents are in the wp_term_taxonomy.term_id field. That table must be part of the MYSQL request as well as the category rejection criterion.

    The category numerical equivalent and taxonomy equvalence table is wp_term_taxonomy. You cannot just look them up in the wp_term_relationships table.

    Looks like we are back in debug mode for a few days.

  17. ~Karolis | 2007 09 27 | Válasz

    Looks like a very useful plugin, but it doesn’t work on WP 2.3 for me :( Hope you can figure out why. If I can be of any help – just let me know.

  18. DjZoNe | 2007 09 27 | Válasz

    Thank you Faro,Rirath, Sean, Jim and Karolis for your reports.
    The new version 1.0.3 is out. It’s available from wordpress.org :)

  19. Jim Hinds | 2007 09 27 | Válasz

    I think I have figured out why the category is excluded sometimes and not others. It is because the SQL query selects for posts with tags OTHER than the ones you wish to exclude. So, if a posting has several tags, it WILL be picked up even though it is in the category you wish to exclude.

    For example (my category for exclusion is 15, and I hand crafted a mySQL query that returns the proper results — the query uses the mysterious ‘NOT EXISTS’ clause:

    SELECT SQL_CALC_FOUND_ROWS distinct wp_posts.* FROM wp_posts WHERE 1=1 AND post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’) AND NOT EXISTS (SELECT * FROM wp_term_relationships JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id WHERE wp_term_relationships.object_id = wp_posts.ID AND wp_term_taxonomy.term_id IN (15) ) ORDER BY post_date DESC LIMIT 0, 6

  20. Jim Hinds | 2007 09 27 | Válasz

    I have changed the two routines ace_join and ace_where to the following code fragment with good results. These changes are not useful for earlier versions of wordpress. And may be entirely incorrect, but for me, right now, these seem to be what is needed.

    function ace_where($where) {
    global $wpdb, $wp_query, $targets;

    if (is_array($targets))
    {
    foreach ($targets as $key=>$val)
    {
    if ($wp_query->$key == 1) $filter = $key;

    }
    }

    $cats_to_exclude = get_option("ace_categories_".$filter);

    if ( !empty($filter) && strlen($cats_to_exclude) > 0)
    {
    if (empty($wpdb->term_relationships)) $where .= " AND $wpdb->post2cat.category_id NOT IN (" . $cats_to_exclude . ")";
    else {
    //$where .= " AND $wpdb->term_relationships.term_taxonomy_id NOT IN (" . $cats_to_exclude . ")";
    $where .= " AND NOT EXISTS (";
    $where .= "SELECT * FROM wp_term_relationships JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id ";
    $where .= "WHERE wp_term_relationships.object_id = wp_posts.ID AND wp_term_taxonomy.term_id IN (" . $cats_to_exclude . ") )";
    }
    }

    return $where;
    }

    function ace_join($join) {
    global $wpdb, $wp_query, $targets;

    if (is_array($targets))
    {
    foreach ($targets as $key=>$val)
    {
    if ($wp_query->$key == 1) $filter = $key;

    }
    $cats_to_exclude = get_option("ace_categories_".$filter);
    }

    if ( !empty($filter) && strlen($cats_to_exclude) > 0)
    {
    if (empty($wpdb->term_relationships))
    {
    if (!preg_match("/post2cat/i",$join)) $join .= " LEFT JOIN $wpdb->post2cat ON $wpdb->post2cat.post_id = $wpdb->posts.ID";
    }
    else
    {
    // if (!preg_match("/$wpdb->term_relationships/i",$join)) $join .=" LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) ";
    // if (!preg_match("/$wpdb->term_taxonomy/i",$join)) $join .=" LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id";
    }
    }

    return $join;
    }

  21. DjZoNe | 2007 09 28 | Válasz

    Jim, thank you for you contribution.

    By the way, does the version (1.0.3) solved the problem, doesn’t it?

  22. David T. | 2007 09 29 | Válasz

    I have installed this plugin on my blog running WP 2.3 and discovered an issue with it. When this plugin is activated on my blog it breaks the tag archive. For example if you were to try and go to http://yoursite.com/tag/foo/ while this plugin in activated, it results in a 404 error. However, as soon as I deactivate this plugin, the tag archive works fine if you go to the page http://yoursite.com/tag/foo. I like how this plugin was fixing my solution of needing to hide a category. The former plugin that I was using is no longer being developed and maintained so it broke with WP 2.3. I hope that we can get this issue resolved because I really would like to use the functionality that this plugin will allow.

  23. Jim Hinds | 2007 09 30 | Válasz

    Yup 1.0.3. Does the job!

    Good coding.

  24. Radu Capan | 2007 10 04 | Válasz

    The same problem as David T. When plugin is activated, the tag archive is not working (404 error). When is not activated, all fine.

  25. CandyShopGirl | 2007 10 09 | Válasz

    Hail!

    What do you think about Tokio Hotel? >:)

  26. Kristin | 2007 10 14 | Válasz

    Great plugin.
    QUESTION: Can I add a page to the five in my admin from which i can exclude posts??
    Thanks!

  27. Deb | 2007 10 23 | Válasz

    The plugin works perfectly for me on WP2.3. However I miss one feature from the plugin I was previously using (Category Visibility), and that is the ability to prevent the names of certain categories from being included in the list in the sidebar. Is it possible to add this function?

  28. DjZoNe | 2007 10 23 | Válasz

    Hi Deb.
    This feature is available in the developement version on wordpress.org.
    Try it if you want to.
    It will be released in a week or so as version v1.1.

  29. caulsedully | 2007 11 27 | Válasz

    Hi, hello, privet
    toyota suprac z

  30. Gowtham | 2008 03 28 | Válasz

    You rock!!!
    Just the right plug-in i was looking for!!
    ROCK ON

7 Visszakövetések

  1. 2007 07 20: DjZoNe
  2. 2007 09 27: Geekularity » links for 2007-09-26
  3. 2007 10 16: Advanced Category Excluder
  4. 2007 10 16: carlo beccaria - blog / Scusate l’ aggiornamento…
  5. 2007 12 08: WP2.3に対応してる、特定のカテゴリを非表示にするためのプラグイン at orioa
  6. 2008 03 02: 特定のカテゴリを非表示にする “Advanced Category Excluder (ACE) plugin for WordPress” | Matter Programming
  7. 2008 09 04: Caramboo Dot Com » Advanced Category Excluder

Szólj hozzá

Itt szabad hozzászólni, vitatkozni, egyetérteni, hőbörögni, meg mindent, amíg valaki értelmes módon teszi ezt meg, és nem személyekedve.

Önmagában azért, mert az nem konstruktív, másrészt pedig mert az ilyen hozzászólásokat megírni sem érdemes, úgysem fognak megjelenni, mivel megjelenés előtti előmoderálás van érvényben.

A hozzászólásokra vonatkozó szabályokat itt olvashatod el részletesen.