#15046 closed defect (bug) (fixed)
places where the_title is used instead of the_title_attribute
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.9 | Priority: | normal |
| Severity: | minor | Version: | 2.3 |
| Component: | Formatting | Keywords: | has-patch |
| Focuses: | Cc: |
Description
[context]
Semantic-web/metadata related plugins popups more and more.
There is no way to filter according to specific tasks (semantic, style, content, ...)
So monolithic the_title and the_author filters are increasingly used.
the_title_attribute [6132] and the_author_meta [11138] partly address the issue
context
Here are the places where the 'content'-oriented function should be used instead of the 'display'
or 'semantic'-oriented versions (often in the 'title' attribute of <a>) :
default-widgets.php, author-template.php and twentyten/functions.php (patches attached)
Attachments (6)
Change History (16)
#2
in reply to:
↑ 1
@
15 years ago
- Cc raphael.droz@… added
Replying to nacin:
I'm not sure of the purpose of get_the_author() to using the author meta function, but the use of the_title_attribute there looks sane.
About the_author_meta(): themes often uses get_the_author() when they just want the 'display name' string (in the "title" attribute of <a>)
The purpose of author-template_get_the_author_meta.patch is to use the unfiltered content in the_author_posts_link() of author-template.php
Thus, doing the following
add_filter('the_author', 'hook');
function hook($author) {
return "<span rel='sioc:has_creator'>$author</span>";
}
doesn't put garbage in <a> @title.
Only thing is, we'll want to remove our esc_attr(). Also, maybe we take all of that logic (the anchor text too) and make it less redundant, that way we're not calling it so many times.
I'm not sure to get it (do you have a ticket reference about this ?)
The question I see is :
When we want an 'unfiltered' version of the content :
1) do we want a partly-filtered content (with only hooks about style|meta|... applied) ?
2) do we want a filtered content where html is stripped ?
3) do we want a filtered content where html is escaped ?
4) do we want an unfiltered content coming directly from the DB ?
...
As it's not quite clear for me (and I'm new to WP code) some patches here use 1) (changing the_title to the_title_attribute) while some others use 3) (adding strip_tags())
I would happily follow existing guidelines/past consideration on this topic if I can find them.
#3
@
15 years ago
- Keywords has-patch added
What nacin was trying to say is that the_title_attribute() is already escaped, so you don't need to pass it through esc_attr() or esc_html() again.
#8
@
13 years ago
- Keywords needs-refresh removed
15046.2 removes redundant title from title attribute in default-widgets and refreshes feed-links patch.
I'm not sure of the purpose of get_the_author() to using the author meta function, but the use of the_title_attribute there looks sane.
Only thing is, we'll want to remove our esc_attr(). Also, maybe we take all of that logic (the anchor text too) and make it less redundant, that way we're not calling it so many times.