[wp-trac] [WordPress Trac] #4287: Links widget has duplicate ID
issue
WordPress Trac
wp-trac at lists.automattic.com
Fri May 18 19:43:18 GMT 2007
#4287: Links widget has duplicate ID issue
---------------------+------------------------------------------------------
Reporter: Otto42 | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.2.1
Component: General | Version: 2.2
Severity: normal | Keywords:
---------------------+------------------------------------------------------
wp_list_bookmarks can generate several "blocks" in the sidebar, one per
category. In combination with the links widget, this can produce several
list items (LI) all using the same id. This will cause the site to fail
validation, since there are duplicated ID's.
The reason this happens is because dynamic_sidebar() builds the
"before_widget" string using replacements for $1 and $2 as the id and
class, respectively. This string then gets passed to wp_list_bookmarks as
the "category_before" parameter.
What really needs to occur, in this particular case, is that the original,
unreplaced, before_widget string needs to get "$1" replaced with "%id",
allowing the normal wp_list_bookmarks code to work correctly, ensuring a
unique ID for each of the bookmark blocks.
What the right was to do this is, I'm not entirely certain. We could copy
the original string to $params[0]['original_before_widget'] and then let
wp_widget_links handle it correctly by doing its own replacement. That
would work.
--
Ticket URL: <http://trac.wordpress.org/ticket/4287>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list