I’m trying to call the wp_list_categories function twice but this gives me a MySQL error.
My reason for wanting to do this is I want to list the contents of 2 parent categories seperately without including the parent category in the list.
I’m using the following code I get the error.
<li> <h2>Browse By Location</h2> <ul><?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=1&title_li='); ?></ul> </li> <li> <h2>Browse By Rating</h2> <ul><?php wp_list_categories('orderby=id&show_count=1&use_desc_for_title=0&child_of=8&title_li='); ?></ul> </li>
However, if I just call the function once I don’t get the error.
When try to call the funtion twice I get one category list being displayed and the other I get the following error.
Warning: join() [function.join]: Bad arguments. in /home/saigonho/public_html/wp-includes/category.php on line 290
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘) AND post_type = ‘post’ AND post_status = ‘publish” at line 1]
SELECT post_id, category_id FROM wp_post2cat LEFT JOIN wp_posts ON post_id = ID WHERE category_id IN () AND post_type = ‘post’ AND post_status = ‘publish’
Warning: Invalid argument supplied for foreach() in /home/saigonho/public_html/wp-includes/category.php on line 300
I’m also running PHP 4.4.6 and MySQL 4.1.21 if that helps.
Any advice would be greatly appreciated.
- The topic ‘Calling wp_list_categories twice gives MySQL error’ is closed to new replies.