Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • confirmed; it does not work (v1.5.2). in fact, it seems that the code isn’t even close to working correctly. to fix it, i’ve hacked up my installation as follows:

    in file template-functions-links.php, at approximately line 221 (in function get_previous_post), you’ll see this:


    $sql_exclude_cats = '';
    if (!empty($excluded_categories)) {
    $blah = explode('and', $excluded_categories);
    foreach($blah as $category) {
    $category = intval($category);
    $sql_exclude_cats .= " AND post_category != $category";
    }
    }

    i replaced that block with the following:

    $sql_exclude_cats = '';
    if (!empty($excluded_categories)) {
    # ronr hack BEGIN
    $query =
    "SELECT post_id
    FROM $wpdb->post2cat
    WHERE category_id IN ("
    . str_replace(',', ',', $excluded_categories)
    . ')';
    $excluded_post_rows = $wpdb->get_results($query);
    if (count($excluded_post_rows) > 0) {
    $sql_exclude_cats =
    ' AND ID NOT IN ('
    . intval($excluded_post_rows[0]->post_id);
    for ($i = 1; $i < (count($excluded_post_rows)); $i++) {
    $sql_exclude_cats .= ',' . intval($excluded_post_rows[$i]->post_
    id);
    }
    $sql_exclude_cats .= ')';
    }
    # ronr hack END
    }

    also did the same in get_next_post, a little farther down in the file.

    my category excludes are just dandy now. i use them thus:


    <?php next_post_link('%link
    &raquo;', '%title', false, '15,16,17') ?>

    note: my code does not do error checking, and it assumes that the parameters passed in are not screwy. <yada yada yada, other disclaimers omitted. constructive suggestions for improvements are always welcome, but please don’t bitch to me about my code; it’s provided as-is.>

    presumably, this will be fixed properly in an upcoming release, so now that i’ve got it working (albeit jury-rigged), i’m not going to spend any more time on it. if it doesn’t get fixed in a future release, perhaps i’ll fold it into an asides plug-in.

    anyway, good luck.

    p.s., you can see the hack in action, here.

    Forum: Requests and Feedback
    In reply to: CSS per page

    this plugin works great on the single-post page–thanks!

    is there a simple way to modify it so that it also includes -all- of the appropriate posts’ stylesheets on multi-post pages (most importantly, the main page)?

    first of all: kudos, team! a great upgrade to a great product.

    secondly, i’ve got a quick Q. i just did the 1.5 > 1.5.1 upgrade, and it went perfectly… almost.

    the only thing which broke was my archives page, where this call started choking:

    wp_list_cats(‘hide_empty=0&sort_column=name&optioncount=1&optiondates=1’);

    the error message (which appeared several times–once for each category) was:

    WordPress database error: [Unknown column 'cat_ID' in 'field list']
    SELECT cat_ID, UNIX_TIMESTAMP( MAX(post_date) ) AS ts FROM wp_posts, wp_post2cat WHERE post_status = 'publish' AND post_id = ID GROUP BY category_id

    i dug a little, and eventually changed “cat_ID” in the SELECT statement on wp-includes/template-functions-category.php line 293 to “category_id,” after which things began working as expected.

    i’m not necessarily asking for help, since:

    (a) it’s fixed (at least it seems to be),
    (b) i’ve made some “customizations” (some might say “hacks”) to the WP files which very well could be related (though i don’t currently see how they could be), and
    (c) i’m not a dumbass newbie who expects people to spend hours helping me, only to find that i didn’t follow directions (no offense to dumbass newbies–i was once one, too. ?? )

    i simply thought i’d throw this out there in case it helps anyone else, or on the off chance that it is in fact a WP bug. (if anyone wants more info, just ask. fwiw, my archive page is here.

    thanks again to the dev team and the entire WP community for creating/supporting a kick-ass product.

Viewing 5 replies - 1 through 5 (of 5 total)