I do custom WordPress theming. I have an unusual client request. He wants to take all the default sidebar widgets and restrict them to category, such as Calendar, Tag Cloud, Recent Comments, etc. Anyone know how to do that?
I found that I can use the add_filter() hook API such that I can intercept all SQL queries in sidebar.php, and adjust them with:
Code: Select all
add_filter('query','myQueryFilterCallback');
function myQueryFilterCallback($args) {
print_r($args);
echo "<br />"
return $args;
}
The only trouble is, I cannot predict what widget a given query is running for. Besides, editing pure SQL is a bit risky because during upgrades of WP the query could be dramatically different.