So recently I upgraded my WordPress installation to WP3.1, however, that broke the slider on my Simplefolio template.
Update July 29, 2011:
I recently upgraded to WordPress 3.2.1, and everything seems to be working properly as expected. Will update if anything breaks.
End of Update
I tried everything from upgrading to the latest bleeding edge, to 3.2 beta, nothing worked, I didn’t want to downgrade to 3.0 simply because I didn’t want the hussle if anything bad were to happen.
$my_query = new WP_Query('showposts=10&category_name=portfolio');
This should theoretically return all the posts under the category named “portfolio” but I get all the post returned that is not in the “portfolio” category.
This query is called:
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND ( wp_posts.ID NOT IN ( SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (5,6,7,45) ) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10
The “NOT” in the query selects everything but the posts from the portfolio category. Bloody hell! It worked before the 3.1 upgrade.
But fear not! Here is a quick hack so that you can get the scroller back without doing massive irreversible hacks and patches.
Before you copy the code, make sure you use the proper apostrophes, WordPress displays the “Letter apostrophe” instead of the normal “typewriter apostrophe” Wiki article.
Go to the admin panel->Appearances->Editor->Home Page Template (template-home.php)
$category = get_option('sf_portfolio_category');
$category = sf_get_category_id(get_option('sf_portfolio_category'));
$my_query = new WP_Query('showposts='.$slide_count.'&category_name='.$category);
$my_query = new WP_Query('showposts='.$slide_count.'&cat='.$category);
And now the scroller is showing the proper posts.
PS: If you find this post useful, or it has saved you some time, effort or money. Feel free donate a can or two of soup to your local food bank :)