link_id,$links_to_exclude) || in_array($bookmarks[$i]->term_id,$linkcategories_to_exclude)) { unset($bookmarks[$i]); } } //print_r($bookmarks); //print_r($links_to_exclude); return $bookmarks; } function ace_list_pages_excludes($excludes) { global $wp_query; if($wp_query->is_page_widget) return $excludes; $filter = ace_get_section(); $posts_to_exclude = get_option("ace_page_sections_".$filter); return explode(",",$posts_to_exclude); } function ace_where($where,$filter="") { global $wpdb, $wp_query; if((!empty($wp_query->is_category) || !empty($wp_query->is_tag) || get_option("ace_settings_onlyinwidget"))) return $where; /* If we are in a category archive, tag archive, or only in widgets don't apply filters */ if (empty($filter)) { $filter = ace_get_section(); } $cats_to_exclude = get_option("ace_categories_".$filter); if ( !empty($filter) && !empty($cats_to_exclude) && strlen($cats_to_exclude) > 0) { $where .= " AND NOT EXISTS ("; $where .= "SELECT * FROM ".$wpdb->term_relationships." JOIN ".$wpdb->term_taxonomy." ON ".$wpdb->term_taxonomy.".term_taxonomy_id = ".$wpdb->term_relationships.".term_taxonomy_id "; $where .= "WHERE ".$wpdb->term_relationships.".object_id = ".$wpdb->posts.".ID AND ".$wpdb->term_taxonomy.".taxonomy = 'category' AND ".$wpdb->term_taxonomy.".term_id IN (" . $cats_to_exclude . ") )"; } return $where; } function ace_join($join,$filter="") { global $wpdb, $wp_query; if(!empty($wp_query->is_category) || !empty($wp_query->is_tag) || get_option("ace_settings_onlyinwidget")) return $join; /* If we are in a category archive, tag archive, or only in widgets don't apply filters */ if (empty($filter)) { $filter = ace_get_section(); } $cats_to_exclude = get_option("ace_categories_".$filter); if ( !empty($filter) && strlen($cats_to_exclude) > 0) { if (!preg_match("/$wpdb->term_relationships/i",$join)) $join .=" LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) "; if (!preg_match("/$wpdb->term_taxonomy/i",$join)) $join .=" LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id"; } return $join; } function ace_distinct($distinct) { global $wp_query; // this won't hurt by default. return "distinct"; } function ace_list_categories($args) /* * Manipulating category list */ { global $wp_query; if (get_option("ace_settings_hide") == 1) /* Only if the user wants this function */ { $filter = ace_get_section(); $cats = get_option("ace_categories_".$filter); if (!empty($cats) && count($cats) > 0) /* if there is any category to hide :) */ { $args = str_replace('