[wp-svn] [3033] trunk/wp-includes/template-functions-category.php: Highlight current class.

Stuart amanzimtoti at gmail.com
Fri Nov 11 00:48:24 GMT 2005


I see this has been changed slightly to add the class to the li
instead of the a tag. How do you highlight just the current category
if there are sub-categories beneath it? Any formatting applied to the
current-cat class gets applied to the sub-categories too.

Cheers - Stuart (amanzi)

On 11/11/05, m at wordpress.org <m at wordpress.org> wrote:
> Revision 3033 Author ryan Date 2005-11-10 23:42:56 +0000 (Thu, 10 Nov 2005)
> Log MessageHighlight current class. Props amanzi and skippy. fixes #1800
> Modified Paths
> trunk/wp-includes/template-functions-category.php
> Diff
> Modified: trunk/wp-includes/template-functions-category.php (3032 =>
> 3033)--- trunk/wp-includes/template-functions-category.php 2005-11-10
> 23:36:50 UTC (rev 3032)
+++
> trunk/wp-includes/template-functions-category.php 2005-11-10 23:42:56 UTC
> (rev 3033)
@@ -272,7 +272,7 @@
 }

 function list_cats($optionall = 1, $all
> = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true,
> $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title =
> 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '',
> $feed_image = '', $exclude = '', $hierarchical=FALSE) {
- global $wpdb,
> $category_posts;
+ global $wpdb, $category_posts, $wp_query;;
 //
> Optiondates now works
 if ( '' == $file )
 $file = get_settings('home') .
> '/';
@@ -381,10 +381,15 @@
 $link .= ' ' . gmdate($optiondates,
> $category_timestamp["$category->cat_ID"]);
 }

- if (
> $list )
- $thelist .= "\t<li>$link\n";
- else
+ if ( $list ) {
+ $thelist .=
> "\t<li";
+ if (($category->cat_ID ==
> $wp_query->get_queried_object_id()) && is_category()) {
+
> $thelist .= ' class="current-cat"';
+ }
+ $thelist .= ">$link\n";
+ } else
> {
 $thelist .= "\t$link<br />\n";
+ }

 if ($hierarchical && $children)
> $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file,
> $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title,
> $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image,
> $exclude, $hierarchical);

>
> _______________________________________________
> wp-svn mailing list
> wp-svn at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-svn
>
>
>


More information about the wp-svn mailing list