Make WordPress Core

Opened 21 years ago

Closed 20 years ago

#2437 closed enhancement (fixed)

Add CSS classes to parents of the current item in the output of wp_list_cats and wp_list_pages [patch]

Reported by: janX Owned by:
Priority: normal Milestone: 2.1.1
Component: General Version: 2.0.1
Severity: normal Keywords: bg|has-patch
Cc: Focuses:

Description

This is a proposal for changes that result in a better output of wp_list_cats and wp_list_pages.

instead of

<li class="page_item"><a href="http://localhost/wp2/mainpage/" title="Main Page">Main Page</a><ul>
	<li class="page_item"><a href="http://localhost/wp2/mainpage/child-1/" title="Child 1">Child 1</a></li>
	<li class="page_item current_page_item"><a href="http://localhost/wp2/mainpage/child-2/" title="Child 2">Child 2</a></li>
</ul>
</li>

you will get

<li class="page_item current_page_parent"><a href="http://localhost/wp2/mainpage/" title="Main Page">Main Page</a><ul>
	<li class="page_item"><a href="http://localhost/wp2/mainpage/child-1/" title="Child 1">Child 1</a></li>
	<li class="page_item current_page_item"><a href="http://localhost/wp2/mainpage/child-2/" title="Child 2">Child 2</a></li>
</ul>
</li>

as the result of a wp_list_pages(...);

instead of

<li class="cat-item">
	<a href="http://localhost/wp2/categories/category/" title="Category's posts">
		Category 
	</a>
	<ul class='children'>
		<li class="cat-item current-cat">
			<a href="http://localhost/wp2/categories/category/subcategory/" title="Subcategory's posts">
				Subcategory 
			</a>
		</li>
	</ul>
</li>

you will get

<li class="cat-item current-cat-parent">
	<a href="http://localhost/wp2/categories/category/" title="Category's posts">
		Category 
	</a>
	<ul class='children'>
		<li class="cat-item current-cat">
			<a href="http://localhost/wp2/categories/category/subcategory/" title="Subcategory's posts">
				Subcategory 
			</a>
		</li>
	</ul>
</li>

as the result of a wp_list_cats(...);

Attachments (2)

template-functions-post.php.diff​ (112 bytes ) - added by janX 21 years ago.
patch for template-functions-post.php
template-functions-category.php.diff​ (617 bytes ) - added by janX 21 years ago.
patch for template-functions-category.php

Download all attachments as: .zip

Change History (5)

@janX
21 years ago

patch for template-functions-post.php

@janX
21 years ago

patch for template-functions-category.php

#1 @janX
21 years ago

This ticket seems to have a similar solution: ​http://trac.wordpress.org/ticket/2395

#2 @matt
20 years ago

  • Milestone 2.1 → 2.2

#3 @francesconegri
20 years ago

  • Milestone 2.2 → 2.1.1
  • Resolution → fixed
  • Status new → closed

the patches are already applied since 2.1 (​http://trac.wordpress.org/changeset/4576)

Note: See TracTickets for help on using tickets.