Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- add_filter('getarchives_where','filtro_getarchives_where');
- add_filter('getarchives_join','filtro_getarchives_join');
- function filtro_getarchives_join($join) {
- global $wpdb;
- if(is_category()) {
- $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) ";
- }
- return $join;
- }
- function filtro_getarchives_where($where) {
- if(is_category()) {
- $category = get_query_var('cat');
- $where .= " AND taxonomy.taxonomy = 'category' AND taxonomy.term_id = ". $category;
- }
- return $where;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement