• Hi all. We’ve only been using Blog-in-Blog for a while, but we ran into an issue I’ve seen reported here, where the pagination doesn’t display the correct number of pages, and I think I’ve found a bug in the SQL generated by the bib_get_post_count() function.
    We’re using the shortcode [blog_in_blog category_slug=’blog’ num=5] and the query generated by the function is:

    SELECT count
    		FROM wp_63_term_taxonomy, wp_63_posts, wp_63_term_relationships, wp_63_terms
    		WHERE wp_63_posts.ID = wp_63_term_relationships.object_id
    		AND wp_63_term_relationships.term_taxonomy_id = wp_63_term_taxonomy.term_taxonomy_id
                        AND wp_63_terms.term_id = wp_63_term_taxonomy.term_taxonomy_id
                        AND wp_63_terms.slug = 'blog'
    		AND wp_63_posts.post_status = 'publish'

    However, this only returns 1 instead of the actual number of published posts with the blog term slug. Looking here: http://codex.wordpress.org/WordPress_Taxonomy
    I think I see the problem: the join condition between the terms and term_taxonomy tables is wrong. I don’t believe it should be:
    wp_63_terms.term_id = wp_63_term_taxonomy.term_taxonomy_id
    but
    wp_63_terms.term_id = wp_63_term_taxonomy.term_id

    If I fix that in line 1003 of the blog-in-blog.php file (v1.1.1), then it works correctly.

    http://wordpress.org/extend/plugins/blog-in-blog/

  • The topic ‘[Plugin: Blog-in-Blog] Category slug count SQL query bug for pagination’ is closed to new replies.