Support » Plugins and Hacks » WP Category Posts and WordPress 2.3

  • Has anyone managed to get WP Category Posts to work with WordPress 2.3? I get a mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource instead of the list of posts.

    Thanks a lot!

Viewing 9 replies - 1 through 9 (of 9 total)
  • just open up the plugin and change this:

    $get_posts_in_cat = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title, ";
    $get_posts_in_cat .= "$wpdb->post2cat.post_id, $wpdb->post2cat.category_id ";
    $get_posts_in_cat .= "FROM $wpdb->posts, $wpdb->post2cat ";
    $get_posts_in_cat .= "WHERE $wpdb->posts.ID = $wpdb->post2cat.post_ID ";
    $get_posts_in_cat .= "AND $wpdb->post2cat.category_id = '$catID' ";
    $get_posts_in_cat .= "AND $wpdb->posts.post_status = 'publish' ";
    $get_posts_in_cat .= "ORDER BY $wpdb->posts.post_title ";

    to this:

    $tp = $wpdb->prefix;
    $get_posts_in_cat = "SELECT ID, {$tp}term_taxonomy.term_id as category_id, post_title
    FROM {$tp}posts, {$tp}term_relationships, {$tp}term_taxonomy
    WHERE {$tp}posts.ID = {$tp}term_relationships.object_id
    AND {$tp}term_relationships.term_taxonomy_id = {$tp}term_taxonomy.term_taxonomy_id
    AND {$tp}term_taxonomy.taxonomy = 'category'
    AND {$tp}term_taxonomy.term_id = '$catID'
    AND post_status = 'publish'
    AND post_type = 'post'
    ORDER BY post_title ";

    should work just fine (works for me ;))

    Thank you so much! You saved me 🙂

    Thank you CrazySerb, I was looking for this too. You saved me a lot of time!

    I installed and it worked like a charm without any tinkering… Am using WP 2.3.1

    Thank you for providing this code. I upgraded to WordPress 2.3 and got the same error message as above. I dropped your code into the plugin file and it corrected the problem. Thank you so much!

    where is this plugin? The one I’ve found doesn’t contain the first block of code…?

    QuinQuin

    (@quinquin)

    CrazySerb you are a genius! Thank you for helping us!!!

    @crazyserb

    Hello brother Serb,…(brate Srbine,pomagaj ako si Srbin…) help me…!

    Is that what you explained here according to this my “categoru problem ?”
    You can read somethig about my problem in Serbiam language

    Thanks a lot.(Hvala unapred!)

    I solved problem by changing the Theme.Previous
    Theme was incompatible with WordPress 2.3.3.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘WP Category Posts and WordPress 2.3’ is closed to new replies.