Advertisement
Guest User

Untitled

a guest
May 6th, 2010
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter('getarchives_where','filtro_getarchives_where');
  4. add_filter('getarchives_join','filtro_getarchives_join');
  5.  
  6. function filtro_getarchives_join($join) {
  7.     global $wpdb;
  8.     if(is_category()) {
  9.         $join .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN         $wpdb->term_taxonomy taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = taxonomy.term_taxonomy_id) ";
  10.     }
  11.     return $join;
  12. }
  13.  
  14. function filtro_getarchives_where($where) {
  15.  
  16.     if(is_category()) {
  17.        
  18.         $category = get_query_var('cat');
  19.         $where .= " AND taxonomy.taxonomy = 'category' AND taxonomy.term_id = ". $category;
  20.    
  21.     }
  22.  
  23.     return $where;
  24. }
  25.  
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement