janx
Forum Replies Created
-
Forum: Plugins
In reply to: Search Meta data\custom fieldsHaving had the same problem I just modified an existing search extension plugin to do what we need. I found the great plugin Search Everything and my modified version optionally searches the custom fields or metdaata. It has been released as 2.2.
The code from the last post is NOT well tested BTW!
I just came up with an idea and here is the result. I hope the support forums’ system preserves this in usable form:
317a318,330
> if ( $hide_empty ) {
> $query = “
> SELECT category_parent, SUM(category_count) AS category_child_count
> FROM $wpdb->categories
> WHERE cat_ID > 0 $exclusions
> GROUP BY category_parent”;
>
> $cat_child_counts = $wpdb->get_results($query);
> foreach ( $cat_child_counts as $cat_child_count ) {
> $category_child_counts[“$cat_child_count->category_parent”] = $cat_child_count->category_child_count;
> }
> }
>
322c335
< if ( ( intval($hide_empty) == 0 || $category->category_count) && (!$hierarchical || $category->category_parent == $child_of) ) {
—
> if ( ( intval($hide_empty) == 0 || $category->category_count || $category_child_counts[$category->cat_ID]/*cat has non-empty children*/ ) && (!$hierarchical || $category->category_parent == $child_of) ) {I am experiencing the same problem. It occurs whenever a categorie doesn’t contain any posts, but one or several of it’s subcategories do. Looking at the code it is obvious why this happens (template-functions-category.php, line 322). I can think of a quick fix for this though. Maybe someone can come up with one.