[wp-trac] [WordPress Trac] #3552: wp_list_cats and list_cats are
broken in 2.1
WordPress Trac
wp-trac at lists.automattic.com
Tue Jan 9 20:00:06 GMT 2007
#3552: wp_list_cats and list_cats are broken in 2.1
----------------------+-----------------------------------------------------
Reporter: Dickie | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.1
Component: Template | Version: 2.1
Severity: major | Keywords: list_cats wp_list_cats template
----------------------+-----------------------------------------------------
While testing out my theme with WP 2.1 I noticed that the newly
depreciated function list_cats does now not work as it used to.
It was defaulting to 'break' behaviour rather than 'list'
This is also true of wp_list_cats although in a different way.
if calling
wp_list_cats("title_li=");
then the display will be an UL list as expected (due to default
behaviour), whereas
wp_list_cats("list=1&title_li=");
will show them with BRs ('break' behaviour), but
wp_list_cats("list=0&title_li=");
will show an UL (this is the wrong way round)
as far as the list_cats function is concerned, that template function will
display a 'break' list regardless of the settings supplied, either
defaulted or not...
I have traced this down to the wp_list_cats function in depreciated.php
line 432
if ( !empty($r[ 'list' ]) )
$r[ 'style' ] = 'break';
this needs to be
if ( isset($r[ 'list' ]) )
$r[ 'style' ] = $r[ 'list' ] ? 'list' : 'break';
This is because the function list_cats() will call this, and $r[ 'list' ]
will never be empty because it is either defaulted or set by the caller,
and therefore it will be set to break.
Plus the test needs to be changed because if the parameter is set to 0
then it is empty, but still set.
I have tested this fix, and it all seems to work fine in all scenarios.
(patch file attached, rev 4709)
--
Ticket URL: <http://trac.wordpress.org/ticket/3552>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list