I have a customized Page template which has long worked just fine, which suddenly is not displaying the way it should. I am pretty sure that the query_posts call is the root of the problem, but I’m open to other ideas.
The page in question has several drop-down lists of posts, generated by custom queries. The lists should all be populated (they used to be, and I haven’t touched the code), but only some of them are.
The really frustrating thing is that I can’t find anything in common between the categories whose posts are NOT showing up. I’m at my wit’s end, and can’t figure out what else to even look at.
There are several identical queries on this page, the only difference is in which category each query draws it’s information from (category_ID is based on category_parent).
Here is an example:
$results = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent FROM ".$wpdb->categories." WHERE category_description != '' AND category_parent = '39' ORDER BY cat_my_order ");
The difference is in the category_parent for each query.
If you’re looking at the page, the first two drop downs (Genesis, Elijah and Elisha) are both generated by the same custom query. One displays, the other does not.
The next two (Who is Jesus, Luke’s Parable) are generated by a different query (essentially the same query, but these two share a different parent category, so they are displayed separately). Neither one of them is displaying.
The next three (Romans, James, Revelation) are generated by another identical query: all three are working fine.
Then in the final query (responsible for Holidays, My Passions, Work), all the category drop downs are displaying posts, except one of them (My Passions).
Probably the best way to see all this is in the pastebin, so http://wordpress.pastebin.com/m2d7ca605 is the complete code for the custom Page template.
I ran Jerome’s Query Diagnostics, and here is the result of loading the template page: http://wordpress.pastebin.com/m5c975cc8
I haven’t installed any new plugins recently, but for the sake of argument, the list of plugins I’m using is here: http://www.timelessword.com/about/wordpress-plugins-used/
If I can supply any further helpful information I’d be happy to. I’m grateful for any suggestions as to where to look for the root of this problem.
- The topic ‘query_posts returns varying results on same page’ is closed to new replies.