WordPress.org

Ready to get started?Download WordPress

Forums

WP Category Posts and WordPress 2.3 (10 posts)

  1. dtailed
    Member
    Posted 6 years ago #

    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!

  2. CrazySerb
    Member
    Posted 6 years ago #

    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 ;))

  3. dtailed
    Member
    Posted 6 years ago #

    Thank you so much! You saved me :)

  4. eduardomaio
    Member
    Posted 6 years ago #

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

  5. ashiado
    Member
    Posted 6 years ago #

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

  6. capstan730
    Member
    Posted 6 years ago #

    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!

  7. syncbox
    Member
    Posted 6 years ago #

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

  8. QuinQuin
    Member
    Posted 6 years ago #

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

  9. Neboja
    Member
    Posted 6 years ago #

    @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!)

  10. Neboja
    Member
    Posted 6 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic